[
https://issues.apache.org/jira/browse/JCLOUDS-856?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ka-Hing Cheung updated JCLOUDS-856:
-----------------------------------
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 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.
{code:java}
@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);
}
}
{code}
was:
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);
}
}
> 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
> Labels: openstack-swift, swift
>
> 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.
> {code:java}
> @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);
> }
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)