fix: Changed image extension validation to MIME type validation

This commit is contained in:
Joedeep Singh
2025-07-03 20:17:41 +00:00
parent f2c8788602
commit 5f04607a44
3 changed files with 14 additions and 11 deletions

View File

@@ -294,9 +294,10 @@ const removeImage = () => {
}
const validateFile = (file) => {
let extension = file.name.split('.').pop().toLowerCase()
if (!['jpg', 'jpeg', 'png'].includes(extension)) {
return 'Only image file is allowed.'
if (!file.type.startsWith('image/')) {
const errorMessage = __('Only image file is allowed.')
toast.error(errorMessage)
return errorMessage
}
}