mirror of
https://github.com/fsouza/fake-gcs-server.git
synced 2026-04-25 13:45:52 +03:00
[GH-ISSUE #1468] Object metadata does not update if a key is removed #202
Labels
No labels
bug
compatibility-issue
docker
documentation
enhancement
help wanted
needs information
pull-request
question
stale
unfortunate
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/fake-gcs-server#202
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @KeithKeithDev on GitHub (Jan 30, 2024).
Original GitHub issue: https://github.com/fsouza/fake-gcs-server/issues/1468
Using version: 1.47.6
I create an object with the initial custom metadata:
{foo=bar, baz=qux}When trying to update the object's metadata with the following map (e.g. the 'foo' entry is now removed)
{baz=qux}using the following code (as per the google gcs documentation here):
The following is logged and we can see that the
fooentry is still there.Updated metadata Map(baz -> qux, foo -> bar)However, if I update the object by changing the mapping of a single entry, so I update with:
{baz=blah}Then I can see that the object's metadata is now updated to have just the 1 key and the
foomapping is gone, as expected:Updated metadata Map(baz -> blah)Is this a bug?
@fsouza commented on GitHub (Feb 8, 2024):
@KeithKeithDev thanks for reporting! This is definitely unexpected.
@KeithKeithDev commented on GitHub (Mar 4, 2024):
@fsouza actually, I may have been making the wrong API call. To delete a key, you need to set a mapping to null for that key as per https://cloud.google.com/storage/docs/json_api#patch. So in reality, I should have called setMetadata with
foo -> null.However, I see another potential issue.
curl http://localhost:55007/storage/v1/b/my-bucket/o. I can see"metadata":{"foo":"bar"}val updated = blob.toBuilder.setMetadata(metadata.asJava).build().update()with a new metadata mapping of "baz" -> "qux".curl http://localhost:55007/storage/v1/b/my-bucket/o. I can see"metadata":{"baz":"qux"}It looks like the original metadata is wiped. https://cloud.google.com/storage/docs/json_api#patch. Can you reproduce this and confirm if it's an issue?
@KeithKeithDev commented on GitHub (Mar 4, 2024):
@fsouza - also, another potential issue.
When deleting a metadata item, it appears that the keys still exist, although the mapped value is "null". For example, if I call:
If I then call
updated.getMetadata, I see:Map(foo -> ). If I do the same test against GCS, I can see it deletes the 'foo' metadata item.@noamshvacher commented on GitHub (Jun 17, 2024):
Hi, any updates on that? I'm experiencing the same issue here