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.
This commit is contained in:
Timur Alperovich 2015-09-11 13:43:35 -07:00
parent 7151a3875b
commit 2c2b498066
1 changed files with 4 additions and 1 deletions

View File

@ -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();
}
}));