From feae011c4d724815c12bdad912c8f94d231f204c Mon Sep 17 00:00:00 2001 From: Andrew Gaul Date: Fri, 18 Mar 2016 13:49:55 -0700 Subject: [PATCH] JCLOUDS-766: URL encode path for v4 signatures Addresses AWSS3BlobIntegrationLiveTest.deleteObject test failures. --- .../src/main/java/org/jclouds/s3/filters/Aws4SignerBase.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apis/s3/src/main/java/org/jclouds/s3/filters/Aws4SignerBase.java b/apis/s3/src/main/java/org/jclouds/s3/filters/Aws4SignerBase.java index 109df5e2f8..3ef5bf4abc 100644 --- a/apis/s3/src/main/java/org/jclouds/s3/filters/Aws4SignerBase.java +++ b/apis/s3/src/main/java/org/jclouds/s3/filters/Aws4SignerBase.java @@ -76,6 +76,8 @@ public abstract class Aws4SignerBase { // A-Z, a-z, 0-9, hyphen (-), underscore (_), period (.), and tilde (~). private static final Escaper AWS_URL_PARAMETER_ESCAPER; + private static final Escaper AWS_PATH_ESCAPER = new PercentEscaper("/-_.~", false); + static { timestampFormat = new SimpleDateFormat("yyyyMMdd'T'HHmmss'Z'"); timestampFormat.setTimeZone(GMT); @@ -384,7 +386,7 @@ public abstract class Aws4SignerBase { canonicalRequest.append(method).append("\n"); // CanonicalURI + '\n' + - canonicalRequest.append(endpoint.getPath()).append("\n"); + canonicalRequest.append(AWS_PATH_ESCAPER.escape(endpoint.getPath())).append("\n"); // CanonicalQueryString + '\n' + if (endpoint.getQuery() != null) {