From 699c5cbaa1e480dd3e9a282b99c5b27233b1536e Mon Sep 17 00:00:00 2001 From: chris Date: Tue, 16 Jun 2026 21:44:37 -0400 Subject: [PATCH] Fix HEIC crash: skip unsupported images gracefully Sharp in this container lacks HEIF support, causing the entire form submission to fail when someone uploads a HEIC file. Wrap each file conversion in try/catch so unsupported formats are skipped with a warning and the message still goes through. Also remove HEIC from the advertised accepted formats in the UI. Co-Authored-By: Claude Sonnet 4.6 --- main-site/contact/index.html | 2 +- main-site/index.html | 2 +- main-site/server.js | 10 +++++++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/main-site/contact/index.html b/main-site/contact/index.html index af75c15..dee7cd0 100644 --- a/main-site/contact/index.html +++ b/main-site/contact/index.html @@ -148,7 +148,7 @@

Drag & drop photos here, or browse

-

JPEG · PNG · HEIC · WebP — max 10 MB each

+

JPEG · PNG · WebP — max 10 MB each

diff --git a/main-site/index.html b/main-site/index.html index 1aa1c8c..48790e7 100644 --- a/main-site/index.html +++ b/main-site/index.html @@ -208,7 +208,7 @@

Drag & drop photos here, or browse

-

JPEG · PNG · HEIC · WebP — max 10 MB each

+

JPEG · PNG · WebP — max 10 MB each

diff --git a/main-site/server.js b/main-site/server.js index 13f982c..f0ef88e 100644 --- a/main-site/server.js +++ b/main-site/server.js @@ -174,9 +174,13 @@ apiRouter.post('/contact', upload.array('photos', 3), async (req, res) => { const attachments = []; for (const file of (req.files || [])) { - const webpBuffer = await sharp(file.buffer).webp({ quality: 85 }).toBuffer(); - const baseName = path.parse(file.originalname).name; - attachments.push({ filename: `${baseName}.webp`, content: webpBuffer, contentType: 'image/webp' }); + try { + const webpBuffer = await sharp(file.buffer).webp({ quality: 85 }).toBuffer(); + const baseName = path.parse(file.originalname).name; + attachments.push({ filename: `${baseName}.webp`, content: webpBuffer, contentType: 'image/webp' }); + } catch (err) { + console.warn(`[${new Date().toISOString()}] Skipping unsupported image ${file.originalname}: ${err.message}`); + } } function formatDate(str) {