Merge branch 'main' of https://git.shiblysolution.id/SAUDE-TL/service-master-data
This commit is contained in:
@ -57,9 +57,9 @@ export class FileController {
|
||||
}
|
||||
|
||||
// Validate file type
|
||||
const allowedMimes = ['image/jpeg', 'image/jpg', 'image/png', 'image/webp'];
|
||||
const allowedMimes = ['image/jpeg', 'image/jpg', 'image/png', 'image/webp', 'image/svg+xml', 'image/svg'];
|
||||
if (!allowedMimes.includes(file.mimetype)) {
|
||||
return ReturnHelper.errorResponse(res, 400, 400, Language.lang.failed_insert, "Invalid file type. Only JPG, PNG, and WEBP are allowed");
|
||||
return ReturnHelper.errorResponse(res, 400, 400, Language.lang.failed_insert, "Invalid file type. Only JPG, PNG, WEBP, and SVG are allowed");
|
||||
}
|
||||
const ext = file.name.split('.');
|
||||
const name = uuidv4() + '.' + ext[ext.length - 1];
|
||||
@ -197,6 +197,7 @@ export class FileController {
|
||||
webp: "image/webp",
|
||||
gif: "image/gif",
|
||||
pdf: "application/pdf",
|
||||
svg: "image/svg+xml",
|
||||
};
|
||||
|
||||
const contentType = mimeMap[ext ?? ""] ?? "application/octet-stream";
|
||||
|
||||
Reference in New Issue
Block a user