Browse Source

Pull request #823: 11.0.25 版本 插件改动合并

Merge in PG/plugin-repository-s3 from release/11.0 to persist/11.0

* commit 'b3caf72fb9ff51fbc452eaafd573d88b56aac992':
  REPORT-112857 fix: 改下isDir的写法
  REPORT-112857 fix: 改下isDir的写法
  REPORT-112563 fix: 修改getEntry方法
persist/11.0
LyKay-王积凯 11 months ago
parent
commit
3b492bac70
  1. 18
      src/main/java/com/fanruan/fs/s3/repository/core/S3ResourceRepository.java

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

@ -101,7 +101,10 @@ public class S3ResourceRepository extends BaseResourceRepository {
} catch (Exception e) {
LogKit.info("{} not exist!", path);
}
if (!path.endsWith(DELIMITER)) {
path = path + DELIMITER;
return getEntry(path);
}
return null;
}
@ -409,16 +412,11 @@ public class S3ResourceRepository extends BaseResourceRepository {
@Override
public boolean isDirectory(String path) {
if (path.endsWith(DELIMITER)) {
return exist(path);
if (!path.endsWith(DELIMITER) && fileExist(path)) {
//是文件
return false;
} 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) || isParentPathAbsent(path);
}
}

Loading…
Cancel
Save