Browse Source

REPORT-112857 fix: 改下isDir的写法

release/11.0
Afly 11 months ago
parent
commit
32d148cbb2
  1. 12
      src/main/java/com/fanruan/fs/s3/repository/core/S3ResourceRepository.java

12
src/main/java/com/fanruan/fs/s3/repository/core/S3ResourceRepository.java

@ -412,17 +412,7 @@ public class S3ResourceRepository extends BaseResourceRepository {
@Override
public boolean isDirectory(String path) {
if (path.endsWith(DELIMITER)) {
return exist(path);
} else {
ObjectListing listing = s3.listObjects(bucket, path);
List<S3ObjectSummary> objectSummaries = listing.getObjectSummaries();
if (objectSummaries.isEmpty()) {
return false;
}
String dirFormat = path + DELIMITER;
return objectSummaries.stream().anyMatch(s3ObjectSummary -> StringUtils.equals(s3ObjectSummary.getKey(), dirFormat));
}
return dirExist(path);
}
@Override

Loading…
Cancel
Save