Skip to content

Commit dfed494

Browse files
fix(common): fallback to empty string (parse uuid pipe)
1 parent 68ea098 commit dfed494

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

packages/common/pipes/parse-uuid.pipe.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,16 @@ export class ParseUUIDPipe implements PipeTransform<string> {
1616
constructor(@Optional() options?: ParseUUIDPipeOptions) {
1717
options = options || {};
1818

19-
this.version = options.version || '4';
19+
this.version = options.version;
2020
this.exceptionFactory =
2121
options.exceptionFactory || (error => new BadRequestException(error));
2222
}
2323
async transform(value: string, metadata: ArgumentMetadata): Promise<string> {
2424
if (!isUUID(value, this.version)) {
2525
throw this.exceptionFactory(
26-
`Validation failed (uuid v${this.version} is expected)`,
26+
`Validation failed (uuid ${
27+
this.version ? 'v' + this.version : ''
28+
} is expected)`,
2729
);
2830
}
2931
return value;

0 commit comments

Comments
 (0)