You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jclouds.apache.org by "Ka-Hing Cheung (JIRA)" <ji...@apache.org> on 2015/05/29 23:03:18 UTC
[jira] [Created] (JCLOUDS-918) putting blobs with % encoded names
gives unexpected results
Ka-Hing Cheung created JCLOUDS-918:
--------------------------------------
Summary: putting blobs with % encoded names gives unexpected results
Key: JCLOUDS-918
URL: https://issues.apache.org/jira/browse/JCLOUDS-918
Project: jclouds
Issue Type: Bug
Reporter: Ka-Hing Cheung
adding this test case causes Swift (but probably all http based providers) to fail:
{code:title=BaseBlobIntegrationTest.java|borderStyle=solid}
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);
}
{code}
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.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)