You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
uploadToSignedUrl silently drops metadata, fileOptions.headers, and duplicates cacheControl #2274
storage.from(bucket).uploadToSignedUrl(path, token, file, options) silently drops three FileOptions that the sibling upload / update methods honor:
options.metadata is never sent.uploadOrUpdate appends a metadata form field for Blob/FormData bodies and sets x-metadata for raw bodies; uploadToSignedUrl has none of those branches.
options.headers is ignored.uploadOrUpdate ends with a for (key, value) of Object.entries(fileOptions.headers) loop that merges via setHeader. uploadToSignedUrl has no such loop, so custom headers are dropped.
cacheControl is appended twice when caller supplies a FormData that already contains it.uploadOrUpdate guards with if (!body.has('cacheControl')); uploadToSignedUrl appends unconditionally.
Reproduction
Against a local Supabase Storage:
consttoken=(awaitstorage.from(bucket).createSignedUploadUrl(path)).data.token// 1. metadata droppedawaitstorage.from(bucket).uploadToSignedUrl(path,token,blob,{metadata: {owner: 'alice'},})// DB storage.objects.user_metadata = {}// 2. headers droppedawaitstorage.from(bucket).uploadToSignedUrl(path,token,blob,{headers: {'x-custom': 'abc'},})// Request does not contain x-custom// 3. cacheControl duplicatedconstfd=newFormData()fd.append('cacheControl','7200')fd.append('',blob)awaitstorage.from(bucket).uploadToSignedUrl(path,token,fd,{cacheControl: '3600'})// FormData ends up with two cacheControl entries
Expected
Same as upload / update: metadata is applied to all three body branches, fileOptions.headers merges via setHeader, and cacheControl is de-duped against the caller-provided FormData.
Environment
@supabase/storage-js 2.104.1 (current master)
Verified end-to-end against a local supabase/storage server (Docker)
Related
Partially helps close #823 (signed-URL metadata feature gap).
Activity