forked from googleapis/google-cloud-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check contentType != null before adding object to rewrite
- Loading branch information
Showing
3 changed files
with
14 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -539,7 +539,7 @@ private RewriteResponse rewrite(RewriteRequest req, String token) throws Storage | |
? req.megabytesRewrittenPerCall * MEGABYTE : null; | ||
com.google.api.services.storage.model.RewriteResponse rewriteReponse = storage.objects() | ||
.rewrite(req.source.getBucket(), req.source.getName(), req.target.getBucket(), | ||
req.target.getName(), req.target) | ||
req.target.getName(), req.target.getContentType() != null ? req.target : null) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
mziccard
Author
Owner
|
||
.setRewriteToken(token) | ||
.setMaxBytesRewrittenPerCall(maxBytesRewrittenPerCall) | ||
.setProjection(DEFAULT_PROJECTION) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Yes, now it is consistent with the previous copy, but I do wonder if that is the right thing to do (silently
ignore any other overridable content such as metadata if content-type is missing...)
At the very least we should probably document
CopyRequest.Builder.target(BlobInfo)
(is that the only placewhere one could provide BlobInfo for a target?) with this kind of side-effect.
Another possible way to make this issue less surprising could be by changing
CopyRequest.Builder
to have 2 separate type of setters for target:
target(BlobId)
andtarget(BlobInfo, BlobTargetOption...)
[and/ortarget(BlobInfo, Iterable<BlobTargetOption>)
]. In that case, we could document [and possible throw an IllegalArgumentException] if the given BlobInfo is missingcontent-type
./cc @BrandonY