feat(storage): add content-encoding support for uploads#1949
feat(storage): add content-encoding support for uploads#1949Athaxv wants to merge 4 commits intosupabase:masterfrom
Conversation
|
Thanks for the PR @Athaxv! This is a great feature request and the client-side implementation looks good. However, the storage server's REST API ( Specifically, in the storage server:
The S3-compatible API routes (/s3/*) already support You can open a feature request on the supabase/storage repo to add You can reference this PR and issue #1883 in that request. The server-side changes would involve:
I'll keep this PR open and we can revisit once the server-side support lands. |
Add content-encoding support for uploads
🔍 Description
contentEncodingtoFileOptionsand apply theContent-Encodingheader for uploads and signed uploads when provided.What changed?
FileOptionswith an optionalcontentEncodingfield.StorageFileApiupload anduploadToSignedUrlto set theContent-Encodingheader whencontentEncodingis passed.storageFileApi.test.tsto assert the correct headers are sent for uploads using streams/buffers.Why was this change needed?
Storage currently doesn’t expose a way to set
Content-Encodingon uploads.This is required to support use cases where files are uploaded already compressed (e.g. gzip) from Edge Functions and should be served correctly in browsers.
Implements the feature requested in Support for setting the Content-Encoding header when uploading files to Storage #1883.
No breaking changes. The new
contentEncodingoption is optional and only affects behavior when explicitly provided.