Uploaded image for project: 'jclouds'
  1. jclouds
  2. JCLOUDS-856

openstack-swift provider mangles blob names that end with slash

    XMLWordPrintableJSON

    Details

      Description

      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 mangling 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);
             }
         }
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                timuralp Timur Alperovich
                Reporter:
                khc Ka-Hing Cheung
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: