Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Duplicate
-
None
-
None
-
None
Description
adding this test case causes Swift (but probably all http based providers) to fail:
diff --git a/blobstore/src/test/java/org/jclouds/blobstore/integration/internal/BaseBlobIntegrationTest.java b/blobstore/src/test/java/org/jclouds/blobstore/integration/internal/BaseBlobIntegrationTest.java index 730d935..c9275ad 100644 --- a/blobstore/src/test/java/org/jclouds/blobstore/integration/internal/BaseBlobIntegrationTest.java +++ b/blobstore/src/test/java/org/jclouds/blobstore/integration/internal/BaseBlobIntegrationTest.java @@ -529,7 +529,8 @@ public class BaseBlobIntegrationTest extends BaseBlobStoreIntegrationTest { return new Object[][] { { "file", "text/xml", file, realObject }, { "string", "text/xml", realObject, realObject }, - { "bytes", "application/octet-stream", realObject.getBytes(), realObject } }; + { "bytes", "application/octet-stream", realObject.getBytes(), realObject }, + { "%20", "text/xml", file, realObject } }; } @Test(groups = { "integration", "live" }, dataProvider = "putTests") @@ -552,6 +553,7 @@ public class BaseBlobIntegrationTest extends BaseBlobStoreIntegrationTest { assertEquals(returnedString, realObject); PageSet<? extends StorageMetadata> set = view.getBlobStore().list(container); assert set.size() == 1 : set; + assertThat(set.iterator().next().getName()).isEqualTo(name); } finally { returnContainer(container); }
The issue is that because the blob name is encoded, Strings2.urlEncode won't encode the name again, so the server side thinks we are trying to put a blob named " ". So on list(), a blob named " " would be returned.
Similarly, if putBlob("%2520") is called, jclouds won't escape the name, so the server sees it as "%20", and will return that as the blob name. However, any jclouds operations on blob "%20" will fail, because again jclouds won't escape "%20", and the server will think that the request is on blob " ", which doesn't exist.
This is the same family of issues as https://issues.apache.org/jira/browse/JCLOUDS-217 . I attempted to address this with https://github.com/jclouds/jclouds/pull/755 but turns out other code has hidden dependencies on broken behaviors.
Attachments
Issue Links
- is duplicated by
-
JCLOUDS-217 URL encoding/decoding issues
- Resolved