From 21bed2dc51a8847e291a85f64304ad73a66ac23a Mon Sep 17 00:00:00 2001 From: Vandana Date: Wed, 18 Mar 2026 21:41:44 -0400 Subject: [PATCH 1/2] fix: map InvalidFileTypeError in error-map and allow image/heic uploads Fixes #298 - Add image/heic to ALLOWED_CONTENT_TYPES in storage/index.ts iOS devices return image/heic from the photo picker; backend was rejecting all iOS photo uploads - Add InvalidFileTypeError case to error-map.ts Missing case caused assertUnreachable() to throw a cryptic 'This should never compile' error instead of a user-friendly validation message --- src/graphql/error-map.ts | 4 ++++ src/services/storage/index.ts | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/graphql/error-map.ts b/src/graphql/error-map.ts index 06ff7be12..26f2211dd 100644 --- a/src/graphql/error-map.ts +++ b/src/graphql/error-map.ts @@ -465,6 +465,10 @@ export const mapError = (error: ApplicationError): CustomApolloError => { message: "Offer not available. Try again.", logger: baseLogger }) + case "InvalidFileTypeError": + message = error.message + return new ValidationInternalError({ message, logger: baseLogger }) + // ---------- // Unhandled below here // ---------- diff --git a/src/services/storage/index.ts b/src/services/storage/index.ts index c25306834..b1db34211 100644 --- a/src/services/storage/index.ts +++ b/src/services/storage/index.ts @@ -13,7 +13,7 @@ import { ErrorLevel } from "@domain/shared" import { InvalidFileTypeError, StorageError } from "./errors" -const ALLOWED_CONTENT_TYPES = ["image/jpeg", "image/png", "image/webp"] as const +const ALLOWED_CONTENT_TYPES = ["image/jpeg", "image/png", "image/webp", "image/heic"] as const const UPLOAD_URL_EXPIRY_SECONDS = 15 * 60 // 15 minutes const READ_URL_EXPIRY_SECONDS = 60 * 60 // 1 hour From 02c815712dc6c58bc2733fde0aaa3cb1333b69e1 Mon Sep 17 00:00:00 2001 From: Vandana Date: Wed, 18 Mar 2026 22:34:31 -0400 Subject: [PATCH 2/2] fix: also map StorageError in error-map StorageError (base class) was also missing from the error map, causing the same assertUnreachable crash when DO_SPACES_BUCKET is not configured on the backend. --- src/graphql/error-map.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/graphql/error-map.ts b/src/graphql/error-map.ts index 26f2211dd..d71176a3f 100644 --- a/src/graphql/error-map.ts +++ b/src/graphql/error-map.ts @@ -465,6 +465,10 @@ export const mapError = (error: ApplicationError): CustomApolloError => { message: "Offer not available. Try again.", logger: baseLogger }) + case "StorageError": + message = error.message + return new UnexpectedClientError({ message, logger: baseLogger }) + case "InvalidFileTypeError": message = error.message return new ValidationInternalError({ message, logger: baseLogger })