fix(security): add fileFilter mime check to pets upload and Throttling to tickets endpoints
This commit is contained in:
1 parent
4d5159a169
commit
e9582430e6
2 files changed
+15
No files matched your search
@@ -75,6 +75,18 @@ export class PetsController {
|
||||
},
|
||||
}),
|
||||
limits: { fileSize: 10 * 1024 * 1024 }, // 10MB
|
||||
fileFilter: (_req, file, callback) => {
|
||||
const allowedMimeTypes = ['image/jpeg', 'image/png', 'image/webp', 'image/gif'];
|
||||
if (!allowedMimeTypes.includes(file.mimetype)) {
|
||||
return callback(
|
||||
new BadRequestException(
|
||||
'فرمت فایل مجاز نیست. لطفاً یکی از فرمتهای JPG, PNG, WEBP را انتخاب کنید',
|
||||
),
|
||||
false,
|
||||
);
|
||||
}
|
||||
callback(null, true);
|
||||
},
|
||||
}),
|
||||
)
|
||||
@ApiOperation({ summary: 'آپلود تصویر حیوان خانگی' })
|
||||
|
||||
Reference in new issue
Block a user