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.
This commit is contained in:
Mat Mannion 2017-04-03 14:49:22 +01:00 committed by Andrew Gaul
parent d47c776cf3
commit 4288c9eb7f
3 changed files with 4 additions and 4 deletions

View File

@ -87,7 +87,7 @@ public class ParseObjectListFromResponse implements Function<HttpResponse, Objec
public SwiftObject apply(InternalObject input) {
if (input.subdir != null) {
return SwiftObject.builder()
.uri(uriBuilder(containerUri).clearQuery().appendPath(input.subdir).build())
.uri(uriBuilder(containerUri).clearQuery().appendPath(urlEncode(input.subdir)).build())
.name(input.subdir)
.etag(SUBDIR_ETAG)
.payload(payload(input.bytes, input.hash, "application/directory", input.expires))

View File

@ -91,8 +91,8 @@ public class ObjectApiMockTest extends BaseOpenStackMockTest<SwiftApi> {
.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());

View File

@ -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",