Browse Source

Pull request #31: DEC-20707 fix: s3直接通过判断名称 + "/"是否存在,来判断是否为文件夹

Merge in PG/plugin-repository-s3 from ~LIDONGY/plugin-repository-s3:release/11.0 to release/11.0

* commit '0e76c422b66e0c7fbc6cc59c1a3f91fed4b5e2e2':
  DEC-20707 fix: s3直接通过判断名称 + "/"是否存在,来判断是否为文件夹
release/11.0
lidongy 3 years ago
parent
commit
2537e05725
  1. 15
      src/main/java/com/fanruan/fs/s3/repository/core/S3ResourceRepository.java

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

@ -249,20 +249,7 @@ public class S3ResourceRepository extends BaseResourceRepository {
@Override
public boolean isDirectory(String path) {
if (path.endsWith(DELIMITER) && exist(path)) {
return true;
}
ObjectListing listing = s3.listObjects(bucket, path);
if (listing.getObjectSummaries().isEmpty()) {
return false;
}
if (listing.getObjectSummaries().size() > 1) {
return true;
} else {
S3ObjectSummary summary = listing.getObjectSummaries().get(0);
return !StringKit.equals(listing.getPrefix(), summary.getKey());
}
return exist(path.endsWith(DELIMITER) ? path : path + DELIMITER);
}
@Override

Loading…
Cancel
Save