Description
Uploading an image fails when the original filename contains a space (e.g., "My Photo.png").
Supabase receives the path but rejects the request due to an unencoded space in the storage key, causing the signed URL download step to fail during analysis.
Steps to Reproduce
-
Open the image upload endpoint (/api/images/upload)
-
Select a file whose name contains a space (e.g., test image.png)
-
Submit
-
Observe that:
- Upload may appear successful initially
- Later, analysis fails with
C2PA tool failed or a 404 from Supabase signed URL
Expected Behavior
File upload and subsequent analysis should succeed even when filenames include spaces. The storage path should be sanitized or URL-safe encoded before persistence.
Actual Behavior
- Supabase stores the object using raw name (with space)
- Signed download URL becomes invalid when re-requested
- Analysis workflow throws an exception during retrieval
Root Cause
Storage path is persisted without normalization/encoding. Supabase requires URL-safe object keys when later generating signed URLs.
Proposed Fix
- Normalize or percent-encode filenames before upload (
space → %20), OR
- Strip unsafe characters from storage path and store canonical name
Description
Uploading an image fails when the original filename contains a space (e.g.,
"My Photo.png").Supabase receives the path but rejects the request due to an unencoded space in the storage key, causing the signed URL download step to fail during analysis.
Steps to Reproduce
Open the image upload endpoint (
/api/images/upload)Select a file whose name contains a space (e.g.,
test image.png)Submit
Observe that:
C2PA tool failedor a404from Supabase signed URLExpected Behavior
File upload and subsequent analysis should succeed even when filenames include spaces. The storage path should be sanitized or URL-safe encoded before persistence.
Actual Behavior
Root Cause
Storage path is persisted without normalization/encoding. Supabase requires URL-safe object keys when later generating signed URLs.
Proposed Fix
space → %20), OR