feat: add WebP image upload support
- Added image/webp to the list of allowed MIME types in the file uploader preprocessor - Added .webp extension validation in ValidUrlExtension validator - Updated error message to include .webp in the list of valid extensions Closes #1055
This commit is contained in:
parent
d4f18d1030
commit
2497bd139d
|
|
@ -88,7 +88,7 @@ export function useUppyUploader(props: {
|
|||
// Expand generic types to specific ones
|
||||
const expandedTypes = allowedTypes.flatMap((type) => {
|
||||
if (type === 'image/*') {
|
||||
return ['image/png', 'image/jpeg', 'image/jpg', 'image/gif'];
|
||||
return ['image/png', 'image/jpeg', 'image/jpg', 'image/gif', 'image/webp'];
|
||||
}
|
||||
if (type === 'video/*') {
|
||||
return ['video/mp4', 'video/mpeg'];
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ export class ValidUrlExtension implements ValidatorConstraintInterface {
|
|||
!!text?.split?.('?')?.[0].endsWith('.jpg') ||
|
||||
!!text?.split?.('?')?.[0].endsWith('.jpeg') ||
|
||||
!!text?.split?.('?')?.[0].endsWith('.gif') ||
|
||||
!!text?.split?.('?')?.[0].endsWith('.webp') ||
|
||||
!!text?.split?.('?')?.[0].endsWith('.mp4')
|
||||
);
|
||||
}
|
||||
|
|
@ -19,7 +20,7 @@ export class ValidUrlExtension implements ValidatorConstraintInterface {
|
|||
defaultMessage(args: ValidationArguments) {
|
||||
// here you can provide default error message if validation failed
|
||||
return (
|
||||
'File must have a valid extension: .png, .jpg, .jpeg, .gif, or .mp4'
|
||||
'File must have a valid extension: .png, .jpg, .jpeg, .gif, .webp, or .mp4'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue