diff --git a/lib/ion-java-1.0.2.jar b/lib/ion-java-1.0.2.jar deleted file mode 100644 index 192a98e..0000000 Binary files a/lib/ion-java-1.0.2.jar and /dev/null differ diff --git a/lib/ion-java-1.11.9.jar b/lib/ion-java-1.11.9.jar new file mode 100644 index 0000000..b467925 Binary files /dev/null and b/lib/ion-java-1.11.9.jar differ diff --git a/lib/jackson-annotations-2.14.1.jar b/lib/jackson-annotations-2.14.1.jar deleted file mode 100644 index e908bd3..0000000 Binary files a/lib/jackson-annotations-2.14.1.jar and /dev/null differ diff --git a/lib/jackson-annotations-2.17.2.jar b/lib/jackson-annotations-2.17.2.jar new file mode 100644 index 0000000..c13bcb9 Binary files /dev/null and b/lib/jackson-annotations-2.17.2.jar differ diff --git a/lib/jackson-core-2.14.1.jar b/lib/jackson-core-2.14.1.jar deleted file mode 100644 index cc02583..0000000 Binary files a/lib/jackson-core-2.14.1.jar and /dev/null differ diff --git a/lib/jackson-core-2.17.2.jar b/lib/jackson-core-2.17.2.jar new file mode 100644 index 0000000..34be902 Binary files /dev/null and b/lib/jackson-core-2.17.2.jar differ diff --git a/lib/jackson-databind-2.14.1.jar b/lib/jackson-databind-2.14.1.jar deleted file mode 100644 index 1ac8096..0000000 Binary files a/lib/jackson-databind-2.14.1.jar and /dev/null differ diff --git a/lib/jackson-databind-2.17.2.jar b/lib/jackson-databind-2.17.2.jar new file mode 100644 index 0000000..3750b8c Binary files /dev/null and b/lib/jackson-databind-2.17.2.jar differ diff --git a/lib/jackson-dataformat-cbor-2.14.1.jar b/lib/jackson-dataformat-cbor-2.14.1.jar deleted file mode 100644 index dc514a6..0000000 Binary files a/lib/jackson-dataformat-cbor-2.14.1.jar and /dev/null differ diff --git a/lib/jackson-dataformat-cbor-2.17.2.jar b/lib/jackson-dataformat-cbor-2.17.2.jar new file mode 100644 index 0000000..d2a691e Binary files /dev/null and b/lib/jackson-dataformat-cbor-2.17.2.jar differ diff --git a/lib/jmespath-java-1.11.801.jar b/lib/jmespath-java-1.11.801.jar deleted file mode 100644 index d4f622c..0000000 Binary files a/lib/jmespath-java-1.11.801.jar and /dev/null differ diff --git a/lib/jmespath-java-1.12.762.jar b/lib/jmespath-java-1.12.762.jar new file mode 100644 index 0000000..ad28413 Binary files /dev/null and b/lib/jmespath-java-1.12.762.jar differ diff --git a/plugin.xml b/plugin.xml index 4282763..ae68af3 100644 --- a/plugin.xml +++ b/plugin.xml @@ -5,12 +5,13 @@ com.fanruan.fs yes no - 1.4.4 + 1.4.5 11.0~11.0 2023-03-14 richie [2024-03-13]国际化更新
[2024-03-13]国际化更新
[2023-11-21]小文件不使用分片上传, 新增preserveMetadata后台配置。
diff --git a/src/main/java/com/fanruan/fs/s3/repository/core/S3Config.java b/src/main/java/com/fanruan/fs/s3/repository/core/S3Config.java index f54bd9e..2d456cd 100644 --- a/src/main/java/com/fanruan/fs/s3/repository/core/S3Config.java +++ b/src/main/java/com/fanruan/fs/s3/repository/core/S3Config.java @@ -44,6 +44,9 @@ public class S3Config extends CommonRepoConfig { @Identifier("preserveMetadata") private Conf preserveMetadata = HolderKit.simple(true); + @Identifier("openVirtualDirectory") + private Conf openVirtualDirectory = HolderKit.simple(true); + @GetConfig("endPoint") public String getEndPoint() { return endPoint.get(); @@ -124,6 +127,16 @@ public class S3Config extends CommonRepoConfig { this.preserveMetadata.set(preserveMetadata); } + @GetConfig("openVirtualDirectory") + public boolean isOpenVirtualDirectory() { + return openVirtualDirectory.get(); + } + + @SetConfig("openVirtualDirectory") + public void setOpenVirtualDirectory(boolean openVirtualDirectory) { + this.openVirtualDirectory.set(openVirtualDirectory); + } + @Override public void update(String key) { super.update(key); @@ -137,6 +150,7 @@ public class S3Config extends CommonRepoConfig { this.setSignerOverride(newConfig.getSignerOverride()); this.setMaxConnections(newConfig.getMaxConnections()); this.setPreserveMetadata(newConfig.isPreserveMetadata()); + this.setOpenVirtualDirectory(newConfig.isOpenVirtualDirectory()); } } @@ -151,6 +165,7 @@ public class S3Config extends CommonRepoConfig { cloned.signerOverride = (Conf) signerOverride.clone(); cloned.maxConnections = (Conf) maxConnections.clone(); cloned.preserveMetadata = (Conf) preserveMetadata.clone(); + cloned.openVirtualDirectory = (Conf) openVirtualDirectory.clone(); return cloned; } } diff --git a/src/main/java/com/fanruan/fs/s3/repository/core/S3ResourceRepository.java b/src/main/java/com/fanruan/fs/s3/repository/core/S3ResourceRepository.java index 6a25448..c6edea8 100644 --- a/src/main/java/com/fanruan/fs/s3/repository/core/S3ResourceRepository.java +++ b/src/main/java/com/fanruan/fs/s3/repository/core/S3ResourceRepository.java @@ -59,6 +59,9 @@ public class S3ResourceRepository extends BaseResourceRepository { private final boolean preserveMetadata; + // 是否将创建a/b/c.txt时的a/b/识别成一个存在的目录 + private final boolean openVirtualDirectory; + private final AmazonS3 s3; private final String bucket; @@ -86,6 +89,7 @@ public class S3ResourceRepository extends BaseResourceRepository { this.s3 = amazonS3ClientBuilder.build(); this.bucket = config.getBucket(); this.preserveMetadata = config.isPreserveMetadata(); + this.openVirtualDirectory = config.isOpenVirtualDirectory(); } @Override @@ -99,6 +103,7 @@ public class S3ResourceRepository extends BaseResourceRepository { ObjectMetadata metadata = s3.getObjectMetadata(bucket, path); return s3Object2FileEntry(metadata, path); } catch (Exception e) { + LogKit.error(e.getMessage(), e); LogKit.info("{} not exist!", path); } if (!path.endsWith(DELIMITER)) { @@ -170,15 +175,15 @@ public class S3ResourceRepository extends BaseResourceRepository { metadata = s3.getObjectMetadata(bucket, path); } catch (Exception ignore) { } - } - if (metadata == null) { - metadata = new ObjectMetadata(); - String mimeType = URLConnection.guessContentTypeFromName(path); - if (mimeType != null) { - metadata.setContentType(mimeType); + if (metadata == null) { + metadata = new ObjectMetadata(); + String mimeType = URLConnection.guessContentTypeFromName(path); + if (mimeType != null) { + metadata.setContentType(mimeType); + } } + metadata.setContentLength(length); } - metadata.setContentLength(length); s3.putObject(bucket, path, new ByteArrayInputStream(data), metadata); } } @@ -330,7 +335,16 @@ public class S3ResourceRepository extends BaseResourceRepository { @Override public boolean exist(String path) { - return fileExist(path) || (!path.endsWith(DELIMITER) && dirExist(path)) || isParentPathAbsent(path); + if (fileExist(path)) { + return true; + } + if ((!path.endsWith(DELIMITER) && dirExist(path))) { + return true; + } + if (openVirtualDirectory) { + return isVirtualDirectory(path); + } + return false; } private boolean fileExist(String path) { @@ -352,9 +366,9 @@ public class S3ResourceRepository extends BaseResourceRepository { } /** - * 如果存在文件创建了,但是其父目录没有创建的场景,为其递归创建对象,返回创建结果 + * 是否将创建对象的前缀(比如a/b/c.txt时的a/b/)识别成一个存在的目录. */ - private boolean isParentPathAbsent(String path) { + private boolean isVirtualDirectory(String path) { if (path.startsWith(DELIMITER)) { path = path.substring(1); } @@ -364,7 +378,8 @@ public class S3ResourceRepository extends BaseResourceRepository { ObjectListing objectListing = s3.listObjects( new ListObjectsRequest() .withBucketName(bucket) - .withPrefix(path)); + .withPrefix(path) + .withDelimiter(DELIMITER)); for (S3ObjectSummary summary : objectListing.getObjectSummaries()) { if (summary.getKey().startsWith(path + DELIMITER)) { return createDirectory(path); @@ -416,7 +431,12 @@ public class S3ResourceRepository extends BaseResourceRepository { //是文件 return false; } else { - return dirExist(path) || isParentPathAbsent(path); + if (dirExist(path)) { + return true; + } else { + // 是一个虚拟的目录 + return openVirtualDirectory && isVirtualDirectory(path); + } } } diff --git a/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_ja_JP.properties b/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_ja_JP.properties index 7219376..78f5dce 100644 --- a/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_ja_JP.properties +++ b/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_ja_JP.properties @@ -5,5 +5,8 @@ Plugin-S3_Bucket=Bucket Plugin-S3_End_Point=Endpoint Plugin-S3_Input=\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002 Plugin-S3_Region=Region -Plugin-S3_Other_Config= -Plugin-S3_EnablePathStyleAccess_Error_Tip= \ No newline at end of file +Plugin-S3_Other_Config=\u3088\u308A\u591A\u304F\u306E\u8A2D\u5B9A +Plugin-S3_EnablePathStyleAccess_Error_Tip=true\u304Bfalse\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044 +Plugin-Xml-I18n-S3repository_Name=S3\u30EA\u30BD\u30FC\u30B9\u30A6\u30A7\u30A2\u30CF\u30A6\u30B9 +Plugin-Xml-I18n-S3repository_Change_Notes=\u0020 +Plugin-Xml-I18n-S3repository_Description=\u3053\u306E\u30D7\u30E9\u30B0\u30A4\u30F3\u306F\u3001S3\u30D7\u30ED\u30C8\u30B3\u30EB\u3092\u30B5\u30DD\u30FC\u30C8\u3059\u308B\u30AF\u30E9\u30A6\u30C9\u30B9\u30C8\u30EC\u30FC\u30B8\u30D5\u30A1\u30A4\u30EB\u30B7\u30B9\u30C6\u30E0\u3092\u30D5\u30A1\u30A4\u30EB\u30B5\u30FC\u30D0\u30FC\u3068\u3057\u3066\u4F7F\u7528\u3067\u304D\u308B\u3088\u3046\u306B\u3057\u307E\u3059\u3002 diff --git a/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_ko_KR.properties b/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_ko_KR.properties index 88f5955..9aadbc0 100644 --- a/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_ko_KR.properties +++ b/src/main/resources/com/fanruan/fs/s3/repository/locale/s3_ko_KR.properties @@ -1,12 +1,12 @@ -Dec-Error_Start_With_Slash_Or_End_Without_Slash= -Plugin-S3_Access_Key_Id= -Plugin-S3_Access_Key_Secret= -Plugin-S3_Bucket= -Plugin-S3_End_Point= -Plugin-S3_Input= -Plugin-S3_Region= -Plugin-S3_Other_Config= -Plugin-S3_EnablePathStyleAccess_Error_Tip= -Plugin-Xml-I18n-S3repository_Name= -Plugin-Xml-I18n-S3repository_Description= -Plugin-Xml-I18n-S3repository_Change_Notes=\u0020 \ No newline at end of file +Dec-Error_Start_With_Slash_Or_End_Without_Slash=\uACBD\uB85C\uC758 \uC2DC\uC791 \uBD80\uBD84\uC5D0 \uC2AC\uB798\uC2DC\uB97C \uAC00\uD560 \uC218 \uC5C6\uC73C\uBA70, \uBC18\uB4DC\uC2DC \uC2AC\uB798\uC2DC\uB85C \uB9C8\uBB34\uB9AC\uD574\uC57C \uD569\uB2C8\uB2E4 +Plugin-S3_Access_Key_Id=AccessKeyId +Plugin-S3_Access_Key_Secret=AccessKeySecret +Plugin-S3_Bucket=Bucket +Plugin-S3_End_Point=Endpoint +Plugin-S3_Input=\uC785\uB825\uD574 \uC8FC\uC138\uC694 +Plugin-S3_Region=Region +Plugin-S3_Other_Config=\uB354 \uB9CE\uC740 \uC124\uC815 +Plugin-S3_EnablePathStyleAccess_Error_Tip=true \uB610\uB294 false\uB97C \uC785\uB825\uD558\uC2ED\uC2DC\uC624 +Plugin-Xml-I18n-S3repository_Name=S3 \uC800\uC7A5\uC18C +Plugin-Xml-I18n-S3repository_Description=s3 \uD504\uB85C\uD1A0\uCF5C\uC744 \uC9C0\uC6D0\uD558\uB294 \uD074\uB77C\uC6B0\uB4DC \uC2A4\uD1A0\uB9AC\uC9C0 \uD30C\uC77C \uC2DC\uC2A4\uD15C\uC744 \uD30C\uC77C \uC11C\uBC84\uB85C \uC0AC\uC6A9\uD569\uB2C8\uB2E4. +Plugin-Xml-I18n-S3repository_Change_Notes=\u0020