From 4288c9eb7f3d920eb24af8da006b8c32f1cff703 Mon Sep 17 00:00:00 2001 From: Mat Mannion Date: Mon, 3 Apr 2017 14:49:22 +0100 Subject: [PATCH] JCLOUDS-1263: URL encode object names from list object response before creating URIs with them This fix calls urlEncode on the path before appending them to the existing path, as the core UriBuilder class expects them to be URL-encoded. --- .../swift/v1/functions/ParseObjectListFromResponse.java | 2 +- .../openstack/swift/v1/features/ObjectApiMockTest.java | 4 ++-- apis/openstack-swift/src/test/resources/object_list.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apis/openstack-swift/src/main/java/org/jclouds/openstack/swift/v1/functions/ParseObjectListFromResponse.java b/apis/openstack-swift/src/main/java/org/jclouds/openstack/swift/v1/functions/ParseObjectListFromResponse.java index a31fe857cf..38c9100685 100644 --- a/apis/openstack-swift/src/main/java/org/jclouds/openstack/swift/v1/functions/ParseObjectListFromResponse.java +++ b/apis/openstack-swift/src/main/java/org/jclouds/openstack/swift/v1/functions/ParseObjectListFromResponse.java @@ -87,7 +87,7 @@ public class ParseObjectListFromResponse implements Function { .payload(payload(64L, "application/octet-stream", null)) .lastModified(dates.iso8601DateParse("2009-02-03T05:26:32.612278")).build(), SwiftObject.builder() - .name("test obj 3") - .uri(URI.create(baseUri + "/test%20obj%203")) + .name("test obj 3 %$.") + .uri(URI.create(baseUri + "/test%20obj%203%20%25%24.")) .etag("0b2e80bd0744d9ebb20484149a57c82e") .payload(payload(14, "application/octet-stream", new Date())) .lastModified(dates.iso8601DateParse("2014-05-20T05:26:32.612278")).build()); diff --git a/apis/openstack-swift/src/test/resources/object_list.json b/apis/openstack-swift/src/test/resources/object_list.json index afe8c77470..0deab8ca5f 100644 --- a/apis/openstack-swift/src/test/resources/object_list.json +++ b/apis/openstack-swift/src/test/resources/object_list.json @@ -14,7 +14,7 @@ "last_modified": "2009-02-03T05:26:32.612278" }, { - "name": "test obj 3", + "name": "test obj 3 %$.", "hash": "0b2e80bd0744d9ebb20484149a57c82e", "bytes": 123, "content_type": "application/octet-stream",