Skip to content

fix(storage): send destination on gRPC copy when target BlobInfo is provided - #14784

Merged
Dhriti07 merged 3 commits into
googleapis:mainfrom
Dhriti07:fix/grpc-copy-override-destination
Oct 27, 2026
Merged

Dhriti07 merged 3 commits into
googleapis:mainfrom
Dhriti07:fix/grpc-copy-override-destination

Conversation

@Dhriti07

@Dhriti07 Dhriti07 commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

When copying with CopyRequest.Builder#setTarget(BlobInfo), the Javadoc says the target info is set exactly to the given BlobInfo and nothing is inherited from the source. The HTTP transport honors this, but the gRPC transport skipped RewriteObjectRequest.destination whenever the target BlobInfo had no fields besides bucket/name. The server then copied the source object's metadata, so callers couldn't clear custom metadata on copy over gRPC.

This change always sends destination when overrideInfo() is true, matching HTTP behavior. setTarget(BlobId) is unchanged and still inherits from the source.

@Dhriti07
Dhriti07 requested review from a team as code owners October 27, 2026 08:41

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the copy method in GrpcStorageImpl.java to ensure that if the caller provides a BlobInfo target (overrideInfo), the destination is always sent to the server, preventing it from falling back to copying the source object's metadata. There are no review comments, and I have no additional feedback to provide.

// otherwise we will clobber default values populated in the gcs server side for the object
// metadata
if (!cleanedDst.equals(Object.getDefaultInstance())) {
// If the caller provided a BlobInfo target (overrideInfo), always send the destination so the

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does the fix work generically for proto2, proto3 etc

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it should work generically. The FIX always sends destination when a target BlobInfo is given, even if it's empty. Proto2 and proto3 both send an empty destination to the server and don't drop it

@Dhriti07
Dhriti07 merged commit 43a67a0 into googleapis:main Oct 27, 2026
203 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants