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
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):
val updated = blob.toBuilder.setMetadata(metadata.asJava).build().update()
println(s"Updated metadata ${updated.getMetadata.asScala}")
The following is logged and we can see that the foo entry 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 foo mapping is gone, as expected: Updated metadata Map(baz -> blah)
Is this a bug?
The text was updated successfully, but these errors were encountered:
@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.
I create an object with initial metadata mapping "foo" -> "bar"
I run the curl command to see the object in fake-gcs-server: curl http://localhost:55007/storage/v1/b/my-bucket/o. I can see "metadata":{"foo":"bar"}
In my code, I call val updated = blob.toBuilder.setMetadata(metadata.asJava).build().update() with a new metadata mapping of "baz" -> "qux".
When I run the same curl command against fake-gcs-server again, to see the object's metadata, curl http://localhost:55007/storage/v1/b/my-bucket/o. I can see "metadata":{"baz":"qux"}
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
foo
entry 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
foo
mapping is gone, as expected:Updated metadata Map(baz -> blah)
Is this a bug?
The text was updated successfully, but these errors were encountered: