You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
New objects being created via the google.cloud.storage.Blob api that have had metadata set on the object via blob.metadata are not having the metadata persisted in the emulator.
To Reproduce
The following code snippet will fail when run against the emulator but work when run against GCS
from google.cloud.storage import Client
from tempfile import NamedTemporaryFile
client = Client()
bucket = client.create_bucket("testbucket")
blob = bucket.blob("test.txt")
blob.metadata = {"foo": "bar"}
with NamedTemporaryFile() as file:
file.write("file-content")
file.flush()
file.seek(0)
blob.upload_from_file(file)
uploaded_blob = bucket.get_blob("test.txt")
assert uploaded_blob.metadata == {"foo": "bar"}
Expected behavior
Any attached metadata should persist on the file saved in the emulator
System (please complete the following information):
OS version: latest gcp-storage-emulator docker image
Python version: 3.12
gcp-storage-emulator version: v2024.08.03
Additional context
I have a proposed fix in the following PR #287
The text was updated successfully, but these errors were encountered:
Describe the bug
New objects being created via the google.cloud.storage.Blob api that have had metadata set on the object via blob.metadata are not having the metadata persisted in the emulator.
To Reproduce
The following code snippet will fail when run against the emulator but work when run against GCS
Expected behavior
Any attached metadata should persist on the file saved in the emulator
System (please complete the following information):
Additional context
I have a proposed fix in the following PR
#287
The text was updated successfully, but these errors were encountered: