Fix regression in storage url signing of objects with slashes in names by mziccard · Pull Request #1348 · googleapis/google-cloud-java · GitHub
Skip to content

Fix regression in storage url signing of objects with slashes in names#1348

Merged
mziccard merged 2 commits into
googleapis:masterfrom
mziccard:signurl-regression
Oct 28, 2016
Merged

Fix regression in storage url signing of objects with slashes in names#1348
mziccard merged 2 commits into
googleapis:masterfrom
mziccard:signurl-regression

Conversation

@mziccard

Copy link
Copy Markdown
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
Copy Markdown

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

Copy link
Copy Markdown

Coverage Status

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

@mziccard

Copy link
Copy Markdown
Contributor Author

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

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

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.

@mickeyreiss mickeyreiss left a comment

Copy link
Copy Markdown

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
Copy Markdown

Coverage Status

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

@lesv

lesv commented Oct 28, 2016

Copy link
Copy Markdown
Contributor

@mziccard mziccard merged commit 76c3a48 into googleapis:master Oct 28, 2016
chingor13 pushed a commit that referenced this pull request Feb 24, 2026
🤖 I have created a release *beep* *boop*
---


### Updating meta-information for bleeding-edge SNAPSHOT release.

---
This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please).
chingor13 pushed a commit that referenced this pull request Mar 12, 2026
🤖 I have created a release *beep* *boop*
---


### Updating meta-information for bleeding-edge SNAPSHOT release.

---
This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please).
suztomo pushed a commit to suztomo/google-cloud-java that referenced this pull request Mar 23, 2026
Fixes the build error in googleapis#1345

This test failure is caused by the recent update that ensures that PostgreSQL-dialect queries also send all comments to Cloud Spanner, which means that the expected query in this test has changed.
meltsufin pushed a commit that referenced this pull request Apr 29, 2026
🤖 I have created a release *beep* *boop*
---


### Updating meta-information for bleeding-edge SNAPSHOT release.

---
This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please).
meltsufin pushed a commit that referenced this pull request May 1, 2026
🤖 I have created a release *beep* *boop*
---


### Updating meta-information for bleeding-edge SNAPSHOT release.

---
This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please).
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