@nestjs/common 10.0.0 → 10.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nestjs/common",
3
- "version": "10.0.0",
3
+ "version": "10.0.1",
4
4
  "description": "Nest - modern, fast, powerful node.js web framework (@common)",
5
5
  "author": "Kamil Mysliwiec",
6
6
  "homepage": "https://nestjs.com",
@@ -16,5 +16,5 @@ export type FileTypeValidatorOptions = {
16
16
  */
17
17
  export declare class FileTypeValidator extends FileValidator<FileTypeValidatorOptions> {
18
18
  buildErrorMessage(): string;
19
- isValid<TFile extends IFile = any>(file: TFile): boolean;
19
+ isValid<TFile extends IFile = any>(file?: TFile): boolean;
20
20
  }
@@ -21,7 +21,8 @@ class FileTypeValidator extends file_validator_interface_1.FileValidator {
21
21
  if (!this.validationOptions) {
22
22
  return true;
23
23
  }
24
- return ('mimetype' in file &&
24
+ return (!!file &&
25
+ 'mimetype' in file &&
25
26
  !!file.mimetype.match(this.validationOptions.fileType));
26
27
  }
27
28
  }
@@ -13,5 +13,5 @@ export type MaxFileSizeValidatorOptions = {
13
13
  */
14
14
  export declare class MaxFileSizeValidator extends FileValidator<MaxFileSizeValidatorOptions> {
15
15
  buildErrorMessage(): string;
16
- isValid<TFile extends IFile = any>(file: TFile): boolean;
16
+ isValid<TFile extends IFile = any>(file?: TFile): boolean;
17
17
  }
@@ -20,7 +20,7 @@ class MaxFileSizeValidator extends file_validator_interface_1.FileValidator {
20
20
  return `Validation failed (expected size is less than ${this.validationOptions.maxSize})`;
21
21
  }
22
22
  isValid(file) {
23
- if (!this.validationOptions) {
23
+ if (!this.validationOptions || !file) {
24
24
  return true;
25
25
  }
26
26
  return 'size' in file && file.size < this.validationOptions.maxSize;