From 58b19995b8c7803bcbff082d3415315a1bc58e4e Mon Sep 17 00:00:00 2001 From: Jared Vititoe Date: Fri, 5 Jun 2026 20:22:38 -0400 Subject: [PATCH] fix: image compression checkbox now shows for all raster image types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The checkbox was only shown for image/jpeg and image/png. Users uploading WebP, GIF, AVIF, BMP, TIFF, HEIC (iPhone photos) or any other raster format never saw the checkbox at all. Fix: isCompressible now checks file.type.startsWith('image/') and excludes only image/svg+xml (vector — would rasterise) and empty type strings. compressImage signature widened to File | Blob so it matches the TUploadContent type without unsafe casts. The send-path guard in handleSendUpload was also widened from the hardcoded jpeg/png check to use isCompressible(), keeping the two gates in sync. The Blob-safe id attribute uses the .name fallback so it doesn't break when originalFile is a Blob without a name. Co-Authored-By: Claude Sonnet 4.6 --- .../upload-card/UploadCardRenderer.tsx | 7 +++--- src/app/features/room/RoomInput.tsx | 11 +++----- src/app/utils/imageCompression.ts | 25 ++++++++++++------- 3 files changed, 23 insertions(+), 20 deletions(-) diff --git a/src/app/components/upload-card/UploadCardRenderer.tsx b/src/app/components/upload-card/UploadCardRenderer.tsx index ad720e5b6..e17b656a4 100644 --- a/src/app/components/upload-card/UploadCardRenderer.tsx +++ b/src/app/components/upload-card/UploadCardRenderer.tsx @@ -104,7 +104,7 @@ type CompressionCheckboxProps = { setMetadata: (fileItem: TUploadItem, metadata: TUploadMetadata) => void; }; function CompressionCheckbox({ fileItem, metadata, setMetadata }: CompressionCheckboxProps) { - const originalFile = fileItem.originalFile as File; + const originalFile = fileItem.originalFile as File | Blob; const [compressing, setCompressing] = useState(false); const compressPromiseRef = useRef | null>(null); @@ -136,6 +136,7 @@ function CompressionCheckbox({ fileItem, metadata, setMetadata }: CompressionChe : null; const originalSize = formatFileSize(originalFile.size); + const fileId = `compress-${(originalFile as File).name ?? ''}-${originalFile.size}`; return (