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

gsutil uses an invalid content-type header #1466

Open
warent opened this issue Feb 13, 2022 · 0 comments
Open

gsutil uses an invalid content-type header #1466

warent opened this issue Feb 13, 2022 · 0 comments

Comments

@warent
Copy link

warent commented Feb 13, 2022

When you make a multipart request to copy, gsutil uses
content-type: multipart/related; boundary='===============8541858631849441928==' note the single quotes. This causes parsing errors in some applications, particularly Golang's mime parser.

https://go.dev/play/p/aHwwWh_ASgs

Doing a string replace with double quotes makes it work

ekimekim added a commit to glideapps/fake-gcs-server that referenced this issue May 26, 2023
`gsutil` sends an invalid multipart boundary param, which golang's `mime.ParseMediaType` correctly rejects.
However, the real GCS evidently does not reject this, so in order to make `gsutil` work we need to support it.

In particular, `gsutil` sends a boundary param that is quoted using single-quotes when it should be using double-quotes.
In cases where the param is definitely invalid (so we're guarenteed not to break any valid values), we replace all single-quotes with double-quotes to produce the intended meaning.

Upstream bug: GoogleCloudPlatform/gsutil#1466
ekimekim added a commit to glideapps/fake-gcs-server that referenced this issue May 26, 2023
`gsutil` sends an invalid multipart boundary param, which golang's `mime.ParseMediaType` correctly rejects.
However, the real GCS evidently does not reject this, so in order to make `gsutil` work we need to support it.

In particular, `gsutil` sends a boundary param that is quoted using single-quotes when it should be using double-quotes.
In cases where the param is definitely invalid (so we're guarenteed not to break any valid values), we replace all single-quotes with double-quotes to produce the intended meaning.

Upstream bug: GoogleCloudPlatform/gsutil#1466
fsouza added a commit to fsouza/fake-gcs-server that referenced this issue May 27, 2023
* multipart uploads: Hack to support gsutil cp

`gsutil` sends an invalid multipart boundary param, which golang's `mime.ParseMediaType` correctly rejects.
However, the real GCS evidently does not reject this, so in order to make `gsutil` work we need to support it.

In particular, `gsutil` sends a boundary param that is quoted using single-quotes when it should be using double-quotes.
In cases where the param is definitely invalid (so we're guarenteed not to break any valid values), we replace all single-quotes with double-quotes to produce the intended meaning.

Upstream bug: GoogleCloudPlatform/gsutil#1466

* Use ` to avoid having to escape

---------

Co-authored-by: fsouza <108725+fsouza@users.noreply.github.com>
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

No branches or pull requests

1 participant