-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix regression in storage url signing of objects with slashes in names #1348
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
Conversation
|
We found a Contributor License Agreement for you (the sender of this pull request) and all commit authors, but as best as we can tell these commits were authored by someone else. If that's the case, please add them to this pull request and have them confirm that they're okay with these commits being contributed to Google. If we're mistaken and you did author these commits, just reply here to confirm. |
|
@mickeyreiss this should fix the regression, feel free to comment on :) |
lesv
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - assuming my questions are incorrect.
| } | ||
| path.append(UrlEscapers.urlPathSegmentEscaper().escape(blobInfo.getName())); | ||
| String escapedName = UrlEscapers.urlFragmentEscaper().escape(blobInfo.getName()); | ||
| path.append(escapedName.replace("?", "%3F")); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| storage.signUrl(BlobInfo.newBuilder(BUCKET_NAME1, blobName).build(), 14, TimeUnit.DAYS); | ||
| String escapedBlobName = UrlEscapers.urlPathSegmentEscaper().escape(blobName); | ||
| String escapedBlobName = | ||
| UrlEscapers.urlFragmentEscaper().escape(blobName).replace("?", "%3F"); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| @Test | ||
| public void testGetSignedUrl() throws IOException { | ||
| String blobName = "test-get-signed-url-blob"; | ||
| String blobName = "test-get-signed-url-blob/with/slashes/and?special=char*"; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
mickeyreiss
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Thanks for the admirably fast turnaround!
| storage.signUrl(BlobInfo.newBuilder(BUCKET_NAME1, blobName).build(), 14, TimeUnit.DAYS); | ||
| String escapedBlobName = UrlEscapers.urlPathSegmentEscaper().escape(blobName); | ||
| String escapedBlobName = | ||
| UrlEscapers.urlFragmentEscaper().escape(blobName).replace("?", "%3F"); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
LGTM |
This replaces #1347 and fixes #1346
@ostronom I took the liberty to cherry-pick your commits and apply some fixes, namely:
?character:UrlEscapers.urlFragmentEscaper()does not escape?. Even though the use of?in blob names is discouraged (see here) we better handle it properlysignUrlintegration tests@ostronom @lesv can you have a look?