Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for gzip transcoding #851

Closed
wants to merge 2 commits into from

Conversation

ekimekim
Copy link
Contributor

@ekimekim ekimekim commented Jul 8, 2022

When an object has Content-Encoding: gzip, and an object download request does not have Accept-Encoding: gzip, GCS will decompress the object before serving it. This is documented here: https://cloud.google.com/storage/docs/transcoding

I've added support for this alongside the current range request logic (it's related - if we are transcoding, we ignore the range header).

To make this work for our use-case I also had to fix a bug in resumable uploads where content encoding metadata was not being set if it was specified in the request body.

EDIT: I just noticed #532, I believe this PR fixes that as well.

These were being set in multipart uploads, but not in resumable uploads.

I opted for the query param to override the body, but I'm not sure if this is the same
behaviour as real GCS.
When an object has Content-Encoding: gzip, and an object download request
does not have Accept-Encoding: gzip, GCS will decompress the object before serving it.
We now replicate this behaviour.
Copy link
Owner

@fsouza fsouza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for contributing and apologies for the delayed response. Can you fix the lint job and add a test or two? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants