mirror of https://github.com/apache/jclouds.git
fix non-recursive list of dir with empty prefix
This commit is contained in:
parent
a56fa3926a
commit
a2ee7341e3
|
@ -524,6 +524,24 @@ public class FilesystemBlobStoreTest {
|
|||
checkForContainerContent(CONTAINER_NAME, dirs);
|
||||
}
|
||||
|
||||
@Test(dataProvider = "ignoreOnMacOSX")
|
||||
public void testListDirectoryBlobsS3FS() {
|
||||
blobStore.createContainerInLocation(null, CONTAINER_NAME);
|
||||
checkForContainerContent(CONTAINER_NAME, null);
|
||||
|
||||
String d = TestUtils.createRandomBlobKey("directory-", "");
|
||||
blobStore.putBlob(CONTAINER_NAME, createDirBlob(d + File.separator));
|
||||
assertTrue(blobStore.blobExists(CONTAINER_NAME, d + File.separator));
|
||||
|
||||
ListContainerOptions options = ListContainerOptions.Builder
|
||||
.withDetails()
|
||||
.inDirectory("");
|
||||
PageSet<? extends StorageMetadata> res = blobStore.list(CONTAINER_NAME, options);
|
||||
assertTrue(res.size() == 1);
|
||||
assertEquals(res.iterator().next().getName(), d);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test of putBlob method with a complex key, with path in the filename, eg
|
||||
* picture/filename.jpg
|
||||
|
|
|
@ -261,7 +261,7 @@ public final class LocalBlobStore implements BlobStore {
|
|||
for (String o : commonPrefixes) {
|
||||
MutableStorageMetadata md = new MutableStorageMetadataImpl();
|
||||
md.setType(StorageType.RELATIVE_PATH);
|
||||
if (prefix != null) {
|
||||
if (prefix != null && !prefix.isEmpty()) {
|
||||
if (!prefix.endsWith(delimiter)) {
|
||||
o = prefix + delimiter + o;
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue