Add file format warning

This commit is contained in:
MartinBraquet
2026-01-26 00:00:37 +01:00
parent 7ca682a4f9
commit beac17cecf

View File

@@ -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