Skip to content

Conversation

@mziccard
Copy link
Contributor

This replaces #1347 and fixes #1346

@ostronom I took the liberty to cherry-pick your commits and apply some fixes, namely:

  • Squash and rebase on top of master
  • Handle ? character: UrlEscapers.urlFragmentEscaper() does not escape ?. Even though the use of ? in blob names is discouraged (see here) we better handle it properly
  • Add slashes and special characters to signUrl integration tests

@ostronom @lesv can you have a look?

@mziccard mziccard added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. api: storage Issues related to the Cloud Storage API. labels Oct 28, 2016
@googlebot
Copy link

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.

@googlebot googlebot added the cla: no This human has *not* signed the Contributor License Agreement. label Oct 28, 2016
@coveralls
Copy link

Coverage Status

Coverage increased (+0.005%) to 84.286% when pulling e5743e4 on mziccard:signurl-regression into 0221851 on GoogleCloudPlatform:master.

@mziccard
Copy link
Contributor Author

@mickeyreiss this should fix the regression, feel free to comment on :)

Copy link
Contributor

@lesv lesv left a 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.

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.

This comment was marked as spam.

@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.

Copy link

@mickeyreiss mickeyreiss left a 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.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.1%) to 84.382% when pulling 988c1c4 on mziccard:signurl-regression into 0221851 on GoogleCloudPlatform:master.

@lesv
Copy link
Contributor

lesv commented Oct 28, 2016

LGTM

@mziccard mziccard merged commit 76c3a48 into googleapis:master Oct 28, 2016
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 Cloud Storage API. cla: no This human has *not* signed the Contributor License Agreement. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression in storage url signing

6 participants