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

Patch call with new content-type does nothing #273

Closed
ex-nerd opened this issue Jun 18, 2020 · 1 comment · Fixed by #1430
Closed

Patch call with new content-type does nothing #273

ex-nerd opened this issue Jun 18, 2020 · 1 comment · Fixed by #1430

Comments

@ex-nerd
Copy link

ex-nerd commented Jun 18, 2020

As far as I can see in the fake-gcs-server code, contentType is only set when the object is created, and can't be updated.

I'm using the official python gcs library, basically as follows:

# init
from google.cloud import storage
client = BigMessyConnectionToFakeGcsServer(storage.Client)
bucket = client.bucket("my-test-bucket")
key = "test-key"

# upload some data
blob = bucket.blob(key)
blob.upload_from_string(b"some data", content_type="application/octet-stream")

# now fix the content type
blob = bucket.get_blob(key)
blob.content_type = "text/plain"
blob.patch()

The content-type value returned from the API request (buried in google's patch() method definition) is the original unchanged application/octet-stream, as is the content-type when trying to download the blob.

Debugging into google's code, this is sending {"contentType": "application/some-new-type"} along with the API request as the body content, which seems to be completely ignored by Server.patchObject unmarshaling into its metadata struct.

@corytheboyd-smartsheet
Copy link

FWIW I think I just ran into this same issue. Wrote the integration test for our feature that updates an object's content-type, and was confused about what I was doing wrong with what I though was a very simple implementation 😅

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

Successfully merging a pull request may close this issue.

3 participants