Skip to content

Commit 396287d

Browse files
committed
fix: filetype detection on upload
1 parent 96b2dba commit 396287d

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

src/common/misc/file.ts

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { FileValidator } from "@common/@types";
22
import { FileSize, FileType } from "@common/@types";
33
import { CustomUploadFileTypeValidator } from "@common/decorators";
4-
import { HttpStatus, ParseFilePipeBuilder, UnprocessableEntityException } from "@nestjs/common";
4+
import { HttpStatus, ParseFilePipeBuilder } from "@nestjs/common";
55

66

77
/**
@@ -32,11 +32,5 @@ export function fileValidatorPipe({
3232
.build({
3333
errorHttpStatusCode: HttpStatus.UNPROCESSABLE_ENTITY,
3434
fileIsRequired: required,
35-
exceptionFactory(error) {
36-
if(error.includes("expected type"))
37-
return new UnprocessableEntityException(`Invalid file type. Valid file types are ${String(fileType).replaceAll(/[$()/]/g, '')}`);
38-
39-
return new UnprocessableEntityException(error);
40-
},
4135
});
4236
}

0 commit comments

Comments
 (0)