fix(storage): apply metadata, headers, and cacheControl dedupe to uploadToSignedUrl#2275
Merged
mandarini merged 1 commit intosupabase:masterfrom Apr 24, 2026
Merged
Conversation
…oadToSignedUrl uploadToSignedUrl was silently dropping three FileOptions that upload/update honor: metadata (no form field or x-metadata header), fileOptions.headers (loop never ran), and de-duping a caller-provided cacheControl field on FormData bodies (appended unconditionally). Mirrors the equivalent handling in uploadOrUpdate across all three body branches (Blob, FormData, raw) and the post-branch fileOptions.headers merge. Tests added alongside the existing uploadToSignedUrl body payload tests.
@supabase/auth-js
@supabase/functions-js
@supabase/postgrest-js
@supabase/realtime-js
@supabase/storage-js
@supabase/supabase-js
commit: |
mandarini
approved these changes
Apr 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2274.
Summary
uploadToSignedUrlsilently drops threeFileOptionsthatupload/updatehonor viauploadOrUpdate:options.metadatais ignored. No form field on Blob/FormData bodies, nox-metadataheader on raw bodies.fileOptions.headersis ignored. ThesetHeadermerge loop was missing.cacheControlon caller-supplied FormData got appended unconditionally, producing two entries when the caller already added one.This patch mirrors the handling from
uploadOrUpdateacross all three body branches (Blob, FormData, raw) and adds the post-branch headers merge. No behavioral change for the content-type / cache-control defaults on raw bodies, nor for the fallbacks when the options are absent.Test plan
uploadToSignedUrl with metadata (Blob body). FormData includes ametadatafield.uploadToSignedUrl with metadata (FormData body). Caller's FormData keeps its own entries and gainsmetadata.uploadToSignedUrl with metadata (raw body sends x-metadata header). Base64-encoded JSON in thex-metadatarequest header.uploadToSignedUrl passes headers.fileOptions.headerskeys reach the outgoing request.uploadToSignedUrl does not duplicate cacheControl when caller FormData has one. Caller's7200wins, SDK's3600default is skipped.All 10
uploadToSignedUrltests pass, including the 5 new ones. The fix was also reproduced end-to-end against a localsupabase/storageDocker server.