JCLOUDS-217: Old Swift should encode blob names. When constructing the URI from the blob names, the deprecated Swift provider should encode the blob names.
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/2c2b4980 Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/2c2b4980 Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/2c2b4980 Branch: refs/heads/master Commit: 2c2b498066b44f49c4f41064aa9f80ecb2a0ac84 Parents: 7151a38 Author: Timur Alperovich <[email protected]> Authored: Fri Sep 11 13:43:35 2015 -0700 Committer: Timur Alperovich <[email protected]> Committed: Thu Sep 17 13:08:44 2015 -0700 ---------------------------------------------------------------------- .../swift/functions/ParseObjectInfoListFromJsonResponse.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/jclouds/blob/2c2b4980/apis/swift/src/main/java/org/jclouds/openstack/swift/functions/ParseObjectInfoListFromJsonResponse.java ---------------------------------------------------------------------- diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/functions/ParseObjectInfoListFromJsonResponse.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/functions/ParseObjectInfoListFromJsonResponse.java index b2e65a3..485408a 100644 --- a/apis/swift/src/main/java/org/jclouds/openstack/swift/functions/ParseObjectInfoListFromJsonResponse.java +++ b/apis/swift/src/main/java/org/jclouds/openstack/swift/functions/ParseObjectInfoListFromJsonResponse.java @@ -38,6 +38,7 @@ import org.jclouds.openstack.swift.domain.internal.ObjectInfoImpl; import org.jclouds.openstack.swift.options.ListContainerOptions; import org.jclouds.rest.InvocationContext; import org.jclouds.rest.internal.GeneratedHttpRequest; +import org.jclouds.util.Strings2; import com.google.common.base.Function; import com.google.common.collect.Iterables; @@ -72,8 +73,10 @@ public class ParseObjectInfoListFromJsonResponse extends ParseJson<PageSet<Objec SortedSet<ObjectInfo> returnVal = Sets.newTreeSet(Iterables.transform(list, new Function<ObjectInfoImpl, ObjectInfo>() { public ObjectInfo apply(ObjectInfoImpl from) { + // appendPath decodes the argument and we should pass an encoded string return from.toBuilder().container(container) - .uri(uriBuilder(request.getEndpoint()).clearQuery().appendPath(from.getName()).build()) + .uri(uriBuilder(request.getEndpoint()).clearQuery().appendPath( + Strings2.urlEncode(from.getName())).build()) .build(); } }));
