Skip to content
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

com.google.cloud.storage.Storage: Cannot clear BlobInfo attributes on update #2662

Closed
RG9 opened this issue Aug 9, 2024 · 1 comment · Fixed by #2664 or #2668
Closed

com.google.cloud.storage.Storage: Cannot clear BlobInfo attributes on update #2662

RG9 opened this issue Aug 9, 2024 · 1 comment · Fixed by #2664 or #2668
Labels
api: storage Issues related to the googleapis/java-storage API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@RG9
Copy link

RG9 commented Aug 9, 2024

Environment details

  • version: google-cloud-storage-2.40.1.jar
  • Java version: 21.0.2

What I want to do using Java API and how it works currently using frontend?

I want to clear (set null) attribute Content-Disposition.

If I left empty Content-Disposition field in following form, then reading value of Blob#getContentDisposition I get null.
Screenshot from 2024-08-09 18-38-32

Javadoc says that it should be possible using update method:
Screenshot from 2024-08-08 20-21-19

Steps to reproduce

  1. Execute Storage#update like this:
    Screenshot from 2024-08-08 20-21-02

Current behavior

contentDisposition value didn't change.

Expected behavior

contentDisposition value should be cleared (set to null).

Debugging

  1. Debugger says that CONTENT_DISPOSITION is modified:
    Screenshot from 2024-08-08 20-21-45
  2. In request's content there is no contentDisposition:
    Screenshot from 2024-08-08 20-25-32
@product-auto-label product-auto-label bot added the api: storage Issues related to the googleapis/java-storage API. label Aug 9, 2024
@BenWhitehead BenWhitehead added priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Aug 12, 2024
BenWhitehead added a commit that referenced this issue Aug 12, 2024
…nsport to properly clear fields

Update StorageImpl#update(BlobInfo) and StorageImpl#update(BucketInfo) to only send modified fields in the case of an actual update. Currently, it simply sends the json version of the current info, this can mean that if a field is cleared the request to gcs doesn't actually include the field to clear.

This same issue does not impact grpc transport, because grpc transport has an explicit `update_mask` that is populated.

Fixes #2662
@BenWhitehead
Copy link
Collaborator

Thanks for raising this issue, fix implemented in #2664

BenWhitehead added a commit that referenced this issue Aug 13, 2024
…nsport to properly clear fields

Update StorageImpl#update(BlobInfo) and StorageImpl#update(BucketInfo) to only send modified fields in the case of an actual update. Currently, it simply sends the json version of the current info, this can mean that if a field is cleared the request to gcs doesn't actually include the field to clear.

This same issue does not impact grpc transport, because grpc transport has an explicit `update_mask` that is populated.

Fixes #2662
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the googleapis/java-storage API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
2 participants