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/03/18 01:24:38 UTC

[jira] [Created] (JCLOUDS-856) openstack-swift provider mingles blob names that end with slash

Ka-Hing Cheung created JCLOUDS-856:
--------------------------------------

             Summary: openstack-swift provider mingles blob names that end with slash
                 Key: JCLOUDS-856
                 URL: https://issues.apache.org/jira/browse/JCLOUDS-856
             Project: jclouds
          Issue Type: Bug
          Components: jclouds-blobstore
    Affects Versions: 2.0.0
            Reporter: Ka-Hing Cheung


Swift (both the old swift and the new openstack-swift providers) deletes trailing slash on listContainer. deleteContainer() also fails if you have a blob with trailing slash.

The mingling is done in MarkersIfDirectoryReturnNameStrategy. Working around that in application is not ideal because metadata.getType() is RELATIVE_PATH could mean a slash was deleted from the end, or the blob's content type is application/directory. It's not clear how to figure out what the real name of the returned objects without probing the store again.

@Test
public void testListObjectWithTrailingSlash() throws InterruptedException {
       BlobStore blobStore = view.getBlobStore();
       String containerName = getContainerName();
       try {
           String key = "a/";
           String etag = blobStore.putBlob(containerName,
                   blobStore.blobBuilder(key).payload("content").build());
           assertThat(etag).isNotNull();
           PageSet<? extends StorageMetadata> res =
                   blobStore.list(containerName, new ListContainerOptions().recursive());
           assertThat(res).hasSize(1);
           StorageMetadata meta = res.iterator().next();
           assertThat(meta.getName()).isEqualTo(key);
       } finally {
           returnContainer(containerName);
       }
   }




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)