mirror of
https://github.com/CompassConnections/Compass.git
synced 2026-05-11 16:49:28 -04:00
Add file format warning
This commit is contained in:
@@ -20,6 +20,20 @@ export const uploadImage = async (
|
||||
let [, ext] = file.name.split('.')
|
||||
const stem = nanoid(10)
|
||||
|
||||
const ALLOWED_TYPES = [
|
||||
'image/jpeg',
|
||||
'image/png',
|
||||
'image/webp',
|
||||
'image/avif',
|
||||
'image/heic',
|
||||
'image/heif',
|
||||
]
|
||||
|
||||
if (!ALLOWED_TYPES.includes(file.type)) {
|
||||
// throw new Error('Unsupported image format')
|
||||
console.warn('Likely unsupported image format', file.type)
|
||||
}
|
||||
|
||||
// Convert HEIC → JPEG immediately (as HEIC not rendered)
|
||||
if (isHeic(file) && typeof window !== 'undefined') {
|
||||
// heic2any available in client only
|
||||
|
||||
Reference in New Issue
Block a user