From 6c07c27e16ec0af9550873468424b35f2c712191 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sun, 21 Dec 2025 23:22:09 +0000 Subject: [PATCH] fix: Support webp images in 3MF thumbnail generation Updated the regex in `get3MFImages` IPC handler in `main.js` to include the `.webp` extension. This ensures that webp images are correctly identified and extracted when generating thumbnails for 3MF files, both in the Metadata directory and throughout the archive. The search is recursive as it iterates over all files in the zip archive. --- main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.js b/main.js index e558bf2..a62e4ae 100644 --- a/main.js +++ b/main.js @@ -2361,7 +2361,7 @@ ipcMain.handle('get3MFImages', async (event, filePath) => { const imageFiles = []; for (const [path, file] of Object.entries(contents.files)) { // Check if file is in Metadata directory first - if (path.toLowerCase().includes('metadata/') && path.match(/\.(png|jpe?g|gif)$/i)) { + if (path.toLowerCase().includes('metadata/') && path.match(/\.(png|jpe?g|gif|webp)$/i)) { console.log('Found image in Metadata:', path); const imageData = await file.async('base64'); imageFiles.push(`data:image/${path.split('.').pop()};base64,${imageData}`); @@ -2372,7 +2372,7 @@ ipcMain.handle('get3MFImages', async (event, filePath) => { if (imageFiles.length === 0) { console.log('\nLooking for images anywhere in 3MF...'); for (const [path, file] of Object.entries(contents.files)) { - if (path.match(/\.(png|jpe?g|gif)$/i)) { + if (path.match(/\.(png|jpe?g|gif|webp)$/i)) { console.log('Found image:', path); const imageData = await file.async('base64'); imageFiles.push(`data:image/${path.split('.').pop()};base64,${imageData}`);