Skip to content

storage: cannot set object properties #536

Closed
@pdknsk

Description

Or at least I haven't figured out how. This is how the documentation suggests it may work.

>>> from gcloud import storage
>>> bucket = storage.get_bucket('bucket', 'id')
>>> key = storage.key.Key(bucket=bucket, name='dir/file.webp', 
...                       properties={'contentType': 'image/webp'})
>>> key.upload_from_filename('dir/file.webp')

Success?

>>> key.properties['contentType']
'image/webp'
>>> key.content_type
'image/webp'

It's a lie unfortunately. (Also verified with gsutil).

>>> webp = bucket.get_key('dir/file.webp')
>>> webp.properties['contentType']
u'application/unknown'
>>> webp.content_type
u'application/unknown'

Metadata

Assignees

Labels

api: storageIssues related to the Cloud Storage API.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions