Skip to content

Commit

Permalink
Fix #14768.
Browse files Browse the repository at this point in the history
  • Loading branch information
dkocher committed Jul 7, 2023
1 parent 02a4af3 commit 09d388e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 16 deletions.
Expand Up @@ -18,7 +18,6 @@
import ch.cyberduck.core.AttributedList;
import ch.cyberduck.core.DefaultIOExceptionMappingService;
import ch.cyberduck.core.DefaultPathContainerService;
import ch.cyberduck.core.DisabledListProgressListener;
import ch.cyberduck.core.ListProgressListener;
import ch.cyberduck.core.ListService;
import ch.cyberduck.core.Path;
Expand Down Expand Up @@ -144,15 +143,6 @@ private Marker parse(final Path directory, final AttributedList<Path> objects,
final Path placeholder = new Path(directory.isDirectory() ? directory : directory.getParent(),
PathNormalizer.name(StringUtils.chomp(info.getFileName(), String.valueOf(Path.DELIMITER))),
EnumSet.of(Path.Type.directory, Path.Type.placeholder));
// Read .bzEmpty
try {
placeholder.withAttributes(attr.find(placeholder, new DisabledListProgressListener()));
}
catch(NotfoundException e) {
// No placeholder object or hidden flag set
log.warn(String.format("Missing placeholder object for prefix %s", info.getFileName()));
placeholder.attributes().setDuplicate(true);
}
objects.add(placeholder);
continue;
}
Expand Down
Expand Up @@ -79,7 +79,7 @@ public void testBucketInvalidCharacter() throws Exception {

@Test
public void testCreatePlaceholder() throws Exception {
final Path bucket = new Path("/XyFraJKj", EnumSet.of(Path.Type.directory, Path.Type.volume));
final Path bucket = new Path("/test-cyberduck", EnumSet.of(Path.Type.directory, Path.Type.volume));
final B2VersionIdProvider fileid = new B2VersionIdProvider(session);
final Path directory = new B2DirectoryFeature(session, fileid, new B2WriteFeature(session, fileid)).mkdir(new Path(bucket, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory)), new TransferStatus());
assertTrue(directory.getType().contains(Path.Type.placeholder));
Expand Down
Expand Up @@ -302,7 +302,7 @@ public void testDisplayFolderInBucketMissingPlaceholder() throws Exception {
assertEquals(1, list.size());
final Path foundFolder1 = list.iterator().next();
assertEquals(folder1, foundFolder1);
assertTrue(foundFolder1.attributes().isDuplicate());
assertFalse(foundFolder1.attributes().isDuplicate());
}
// Nullify version to add delete marker
new B2DeleteFeature(session, fileid).delete(Collections.singletonList(new Path(file1).withAttributes(new PathAttributes(file1.attributes()).withVersionId(null))), new DisabledLoginCallback(), new Delete.DisabledCallback());
Expand Down Expand Up @@ -332,20 +332,20 @@ public void testDisplayFolderInFolderMissingPlaceholder() throws Exception {
assertEquals(1, list.size());
final Path foundFolder1 = list.iterator().next();
assertEquals(folder1, foundFolder1);
assertTrue(foundFolder1.attributes().isDuplicate());
assertFalse(foundFolder1.attributes().isDuplicate());
}
{
final AttributedList<Path> list = new B2ObjectListService(session, fileid).list(folder1, new DisabledListProgressListener());
assertEquals(1, list.size());
final Path foundFolder2 = list.iterator().next();
assertEquals(folder2, foundFolder2);
assertTrue(foundFolder2.attributes().isDuplicate());
assertFalse(foundFolder2.attributes().isDuplicate());
}
// Nullify version to add delete marker
new B2DeleteFeature(session, fileid).delete(Collections.singletonList(file.withAttributes(new PathAttributes(file.attributes()).withVersionId(null))), new DisabledLoginCallback(), new Delete.DisabledCallback());
assertFalse(new DefaultFindFeature(session).find(folder1, new DisabledListProgressListener()));
assertTrue(new DefaultFindFeature(session).find(folder1, new DisabledListProgressListener()));
assertTrue(new B2ObjectListService(session, fileid).list(folder1, new DisabledListProgressListener()).contains(folder2));
assertFalse(new DefaultFindFeature(session).find(folder2, new DisabledListProgressListener()));
assertTrue(new DefaultFindFeature(session).find(folder2, new DisabledListProgressListener()));
assertEquals(2, new B2ObjectListService(session, fileid).list(folder2, new DisabledListProgressListener()).size());
assertThrows(NotfoundException.class, () -> new B2ObjectListService(session, fileid, 1, VersioningConfiguration.empty()).list(folder2, new DisabledListProgressListener()));
for(Path f : new B2ObjectListService(session, fileid).list(folder2, new DisabledListProgressListener())) {
Expand Down

0 comments on commit 09d388e

Please sign in to comment.