Skip to content

Commit 748e472

Browse files
authored
Merge pull request #14542 from iterate-ch/bugfix/GH-14527
Fix #14527.
2 parents 913df0d + c8bf429 commit 748e472

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

backblaze/src/main/java/ch/cyberduck/core/b2/B2AttributesFinderFeature.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,21 +91,16 @@ public PathAttributes find(final Path file, final ListProgressListener listener)
9191
}
9292
}
9393
else {
94-
9594
final String id = fileid.getVersionId(file);
95+
B2FileResponse response;
9696
try {
97-
return this.findFileInfo(file, id);
97+
response = this.findFileInfo(file, id);
9898
}
9999
catch(NotfoundException e) {
100100
// Try with reset cache after failure finding node id
101-
return this.findFileInfo(file, fileid.getVersionId(file));
101+
response = this.findFileInfo(file, fileid.getVersionId(file));
102102
}
103-
}
104-
}
105-
106-
private PathAttributes findFileInfo(final Path file, final String id) throws BackgroundException {
107-
try {
108-
final PathAttributes attr = this.toAttributes(session.getClient().getFileInfo(id));
103+
final PathAttributes attr = this.toAttributes(response);
109104
if(attr.isDuplicate()) {
110105
// Throw failure if latest version has hide marker set and lookup was without explicit version
111106
if(StringUtils.isBlank(file.attributes().getVersionId())) {
@@ -117,6 +112,12 @@ private PathAttributes findFileInfo(final Path file, final String id) throws Bac
117112
}
118113
return attr;
119114
}
115+
}
116+
117+
private B2FileResponse findFileInfo(final Path file, final String id) throws BackgroundException {
118+
try {
119+
return session.getClient().getFileInfo(id);
120+
}
120121
catch(B2ApiException e) {
121122
throw new B2ExceptionMappingService(fileid).map("Failure to read attributes of {0}", e, file);
122123
}

backblaze/src/main/java/ch/cyberduck/core/b2/B2ObjectListService.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
import java.util.EnumSet;
3838
import java.util.HashMap;
3939
import java.util.Map;
40-
import java.util.stream.Collectors;
4140

4241
import synapticloop.b2.Action;
4342
import synapticloop.b2.exception.B2ApiException;
@@ -133,8 +132,12 @@ private Marker parse(final Path directory, final AttributedList<Path> objects,
133132
final Path placeholder = new Path(directory.isDirectory() ? directory : directory.getParent(),
134133
PathNormalizer.name(StringUtils.chomp(info.getFileName(), String.valueOf(Path.DELIMITER))),
135134
EnumSet.of(Path.Type.directory, Path.Type.placeholder));
136-
// Need to check if only hidden files inside
137-
if(this.list(placeholder, new DisabledListProgressListener()).toStream().filter(f -> !f.attributes().isDuplicate()).collect(Collectors.toList()).isEmpty()) {
135+
// Read .bzEmpty
136+
try {
137+
placeholder.withAttributes(attr.find(placeholder, new DisabledListProgressListener()));
138+
}
139+
catch(NotfoundException e) {
140+
// No placeholder object or hidden flag set
138141
placeholder.attributes().setDuplicate(true);
139142
}
140143
objects.add(placeholder);

0 commit comments

Comments
 (0)