mirror of https://github.com/apache/jclouds.git
fix non-recursive list with empty prefix
This commit is contained in:
parent
7c9d6f7627
commit
be7b9f4cc4
|
@ -174,6 +174,21 @@ public class FilesystemBlobStoreTest {
|
|||
checkForContainerContent(CONTAINER_NAME, blobsExpected);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testList_RootNonRecursive() throws IOException {
|
||||
blobStore.createContainerInLocation(null, CONTAINER_NAME);
|
||||
// Testing list for an empty container
|
||||
checkForContainerContent(CONTAINER_NAME, null);
|
||||
|
||||
TestUtils.createBlobsInContainer(CONTAINER_NAME, "a");
|
||||
ListContainerOptions options = ListContainerOptions.Builder
|
||||
.withDetails()
|
||||
.inDirectory("");
|
||||
PageSet<? extends StorageMetadata> res = blobStore.list(CONTAINER_NAME, options);
|
||||
assertTrue(res.size() == 1);
|
||||
assertEquals(res.iterator().next().getName(), "a");
|
||||
}
|
||||
|
||||
public void testList_NotExistingContainer() {
|
||||
// Testing list for a not existing container
|
||||
try {
|
||||
|
|
|
@ -408,7 +408,7 @@ public final class LocalBlobStore implements BlobStore {
|
|||
}
|
||||
|
||||
public boolean apply(StorageMetadata metadata) {
|
||||
if (prefix == null)
|
||||
if (prefix == null || prefix.isEmpty())
|
||||
return metadata.getName().indexOf(delimiter) == -1;
|
||||
// ensure we don't accidentally append twice
|
||||
String toMatch = prefix.endsWith("/") ? prefix : prefix + delimiter;
|
||||
|
|
Loading…
Reference in New Issue