JCLOUDS-766: URL encode path for v4 signatures

Addresses AWSS3BlobIntegrationLiveTest.deleteObject test failures.
This commit is contained in:
Andrew Gaul 2016-03-18 13:49:55 -07:00
parent 2501122a20
commit feae011c4d
1 changed files with 3 additions and 1 deletions

View File

@ -76,6 +76,8 @@ public abstract class Aws4SignerBase {
// A-Z, a-z, 0-9, hyphen (-), underscore (_), period (.), and tilde (~). // A-Z, a-z, 0-9, hyphen (-), underscore (_), period (.), and tilde (~).
private static final Escaper AWS_URL_PARAMETER_ESCAPER; private static final Escaper AWS_URL_PARAMETER_ESCAPER;
private static final Escaper AWS_PATH_ESCAPER = new PercentEscaper("/-_.~", false);
static { static {
timestampFormat = new SimpleDateFormat("yyyyMMdd'T'HHmmss'Z'"); timestampFormat = new SimpleDateFormat("yyyyMMdd'T'HHmmss'Z'");
timestampFormat.setTimeZone(GMT); timestampFormat.setTimeZone(GMT);
@ -384,7 +386,7 @@ public abstract class Aws4SignerBase {
canonicalRequest.append(method).append("\n"); canonicalRequest.append(method).append("\n");
// CanonicalURI + '\n' + // CanonicalURI + '\n' +
canonicalRequest.append(endpoint.getPath()).append("\n"); canonicalRequest.append(AWS_PATH_ESCAPER.escape(endpoint.getPath())).append("\n");
// CanonicalQueryString + '\n' + // CanonicalQueryString + '\n' +
if (endpoint.getQuery() != null) { if (endpoint.getQuery() != null) {