You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using HasMimeType decorator of 'nestjs-form-data' in dto.
@HasMimeType([
'image/bmp',
'image/gif',
'image/jpeg',
'image/png',
'image/webp',
'image/svg+xml',
])
When uploading the svg file of mime type 'image/svg+xml', I was getting validation error of mimetype.
Error message -> "File must be of one of the types image/bmp, image/gif, image/jpeg, image/png, image/webp, image/svg+xml"
I tried to check the mimetype of image by commenting this decorator, so I found that it was converting the mimetype 'image/svg+xml' to 'application/xml' which violates the validations.
This is problematic as we are using the fileType.ext extension to save the file to our database and when this is streamed, the image is unrenderable as the path now refers to a file with extension .xml instead of the correct .svg.
The text was updated successfully, but these errors were encountered:
I am using HasMimeType decorator of 'nestjs-form-data' in dto.
@HasMimeType([
'image/bmp',
'image/gif',
'image/jpeg',
'image/png',
'image/webp',
'image/svg+xml',
])
When uploading the svg file of mime type 'image/svg+xml', I was getting validation error of mimetype.
Error message -> "File must be of one of the types image/bmp, image/gif, image/jpeg, image/png, image/webp, image/svg+xml"
I tried to check the mimetype of image by commenting this decorator, so I found that it was converting the mimetype 'image/svg+xml' to 'application/xml' which violates the validations.
Console message of the file uploaded ->
FileSystemStoredFile {
originalName: 'image.svg',
encoding: '7bit',
busBoyMimeType: 'image/svg+xml',
path: '/home/Documents/project/image.svg',
size: 100314,
fileType: { ext: 'xml', mime: 'application/xml' }
}
This is problematic as we are using the
fileType.ext
extension to save the file to our database and when this is streamed, the image is unrenderable as the path now refers to a file with extension.xml
instead of the correct.svg
.The text was updated successfully, but these errors were encountered: