KEMBAR78
fix: update modified field handling for blob and bucket with json transport to properly clear fields by BenWhitehead · Pull Request #2664 · googleapis/java-storage · GitHub
Skip to content

Conversation

@BenWhitehead
Copy link
Collaborator

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.

Add some tests to ensure things work and continue to work.

In order to handle this, we have to explicitly include a Data.nullOf(Class) in the respective apiary model. Each of the Data.nullOfs must match the type of the field. Because of this, we now need to track the apiary type for each field. To this end, a new internal field has been added to BlobField and BucketField to map to the corresponding apiary type.

Fixes #2662

@BenWhitehead BenWhitehead added the owlbot:ignore instruct owl-bot to ignore a PR label Aug 12, 2024
@BenWhitehead BenWhitehead requested a review from a team as a code owner August 12, 2024 21:14
@BenWhitehead BenWhitehead changed the title ix: update modified field handling for blob and bucket with json transport to properly clear fields fix: update modified field handling for blob and bucket with json transport to properly clear fields Aug 12, 2024
@product-auto-label product-auto-label bot added size: l Pull request size is large. api: storage Issues related to the googleapis/java-storage API. labels 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 BenWhitehead merged commit e2f5537 into main Aug 15, 2024
@BenWhitehead BenWhitehead deleted the fix-2662 branch August 15, 2024 21:43
BenWhitehead added a commit that referenced this pull request Mar 20, 2025
…ing HTTP Transport

If a generation is present in the provided BlobInfo ensure it is sent to GCS. This is
a hard requirement when using versioned buckets and trying to update a non-current
object version.

Effects all version 2.42.0 through 2.50.0

Regression introduced in #2664

Fixes #2980
BenWhitehead added a commit that referenced this pull request Mar 21, 2025
…ing HTTP Transport (#3006)

If a generation is present in the provided BlobInfo ensure it is sent to GCS. This is
a hard requirement when using versioned buckets and trying to update a non-current
object version.

Effects all version 2.42.0 through 2.50.0

Regression introduced in #2664

Fixes #2980
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. owlbot:ignore instruct owl-bot to ignore a PR size: l Pull request size is large.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants