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
Blob's custom_time is lost on upload. #372
Comments
For example Codefrom google.cloud import storage
bucket_name = "my-test-bucket"
blob_name = "test_blob"
client = storage.Client()
bucket = client.get_bucket(bucket_name)
blob = bucket.blob(blob_name)
blob.content_encoding = "gzip"
print("Before upload {}".format(blob.content_encoding))
blob.upload_from_string("test")
blob.reload()
print("After upload {}".format(blob.content_encoding)) Output
Is the reason that python-storage/google/cloud/storage/blob.py Lines 92 to 103 in 5c60d24
Which is used by python-storage/google/cloud/storage/blob.py Lines 1518 to 1547 in 5c60d24
And which is then used by python-storage/google/cloud/storage/blob.py Lines 1549 to 1571 in 5c60d24
|
I was able to reproduce this and discovered custom_time was missing from attributes to set during blob creation. Will send a PR with a fix. |
The custom_time property was incorrectly not included as a field that could be set on object upload. Fixes googleapis#372
The custom_time property was incorrectly not included as a field that could be set on object upload. Fixes #372
The custom_time property was incorrectly not included as a field that could be set on object upload. Fixes googleapis#372
The custom_time property was incorrectly not included as a field that could be set on object upload. Fixes googleapis#372
Environment details
google-cloud-storage
version: 1.35.1Steps to reproduce
custom_time
.custom_time
.datatime
, but the actual result isNone
.If blob's
custom_time
is set before uploading, it is just lost. My understanding is that the metadata could be uploaded with the object's content at the same time without needing to patch it afterwards.https://cloud.google.com/storage/docs/uploading-objects#rest-upload-objects
Code example
Stack trace
The text was updated successfully, but these errors were encountered: