diff --git a/README.md b/README.md index 35987470..b09503b6 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,8 @@ Amazon S3、GoogleCloud Storage、金山云 KS3、美团云 MSS、京东云 OSS 后续即将支持 Samba、NFS +`1.0.3` 修复了 FileStorageClientFactory 未自动加载等问题,查看 [更新记录](https://spring-file-storage.xuyanwu.cn/#/更新记录?id=103) +
`1.0.2` 修复了华为云 OBS 未加载的问题,查看 [更新记录](https://spring-file-storage.xuyanwu.cn/#/更新记录?id=102)
`1.0.1` 修复了 MultipartFile 无法正确获取文件名等问题,查看 [更新记录](https://spring-file-storage.xuyanwu.cn/#/更新记录?id=101) diff --git a/docs/README.md b/docs/README.md index a4a244ca..eda23e7d 100644 --- a/docs/README.md +++ b/docs/README.md @@ -32,6 +32,8 @@ Amazon S3、GoogleCloud Storage、金山云 KS3、美团云 MSS、京东云 OSS 后续即将支持 Samba、NFS +`1.0.3` 修复了 FileStorageClientFactory 未自动加载等问题,查看 [更新记录](更新记录?id=103) +
`1.0.2` 修复了华为云 OBS 未加载的问题,查看 [更新记录](更新记录?id=102)
`1.0.1` 修复了 MultipartFile 无法正确获取文件名等问题,查看 [更新记录](更新记录?id=101) diff --git a/docs/_navbar.md b/docs/_navbar.md index b80bc3db..9442fbc3 100644 --- a/docs/_navbar.md +++ b/docs/_navbar.md @@ -1,4 +1,6 @@ -* 文档版本 1.0.2 +* 文档版本 1.0.3 + + * [1.0.3](https://spring-file-storage.xuyanwu.cn/1.0.3/) * [1.0.2](https://spring-file-storage.xuyanwu.cn/1.0.2/) * [1.0.1](https://spring-file-storage.xuyanwu.cn/1.0.1/) * [1.0.0](https://spring-file-storage.xuyanwu.cn/1.0.0/) diff --git "a/docs/\345\255\230\345\202\250\345\271\263\345\217\260.md" "b/docs/\345\255\230\345\202\250\345\271\263\345\217\260.md" index d9b5b183..e8d35e98 100644 --- "a/docs/\345\255\230\345\202\250\345\271\263\345\217\260.md" +++ "b/docs/\345\255\230\345\202\250\345\271\263\345\217\260.md" @@ -243,8 +243,8 @@ public class HuaweiObsFileStorage implements FileStorage { } else if (acl instanceof String || acl == null) { String sAcl = (String) acl; if (StrUtil.isEmpty(sAcl)) sAcl = defaultAcl; - IConvertor convertor = ReflectUtil.invoke(getClient(),"getIConvertor",bucketName); - return convertor.transCannedAcl(sAcl); + if (sAcl == null) return null; + return ObsConvertor.getInstance().transCannedAcl(sAcl); } else { throw new FileStorageRuntimeException("不支持的ACL:" + acl); } @@ -391,7 +391,7 @@ public class HuaweiObsFileStorageClientFactory implements FileStorageClientFacto > [!TIP|label:小提示:] > 1. FTP 和 SFTP 就是通过 Client 工厂类和对象池配合来提升性能的,具体可以查看相关源码 > -> 2. 如果自定义的存储平台比较简单,也可以不用工厂类直接在存储平台中创建 Client 对象, `0.8.0` 之前的版本就是这种方式 +> 2. 如果自定义的存储平台比较简单,也可以不用工厂类直接在存储平台中创建 Client 对象, `1.0.0` 之前的版本就是这种方式 > > 3. 如果自带的 Client 工厂类满足不了你的需求,例如想添加网络代理,只要自定义一个 Client 工厂类就可以了,不用重新自定义整个存储平台,在后续文档中会详细说明 @@ -467,7 +467,7 @@ spring: @Bean public List> myHuaweiObsFileStorageClientFactory(SpringFileStorageProperties properties) { return properties.getHuaweiObs().stream() - .filter(SpringHuaweiObsConfigConfig::getEnableStorage) + .filter(SpringHuaweiObsConfig::getEnableStorage) .map(config -> new FileStorageClientFactory() { private volatile ObsClient client; diff --git "a/docs/\345\277\253\351\200\237\345\205\245\351\227\250.md" "b/docs/\345\277\253\351\200\237\345\205\245\351\227\250.md" index 2f8b08f5..5411bc8c 100644 --- "a/docs/\345\277\253\351\200\237\345\205\245\351\227\250.md" +++ "b/docs/\345\277\253\351\200\237\345\205\245\351\227\250.md" @@ -8,7 +8,7 @@ cn.xuyanwu spring-file-storage - 1.0.2 + 1.0.3 ``` diff --git "a/docs/\346\233\264\346\226\260\350\256\260\345\275\225.md" "b/docs/\346\233\264\346\226\260\350\256\260\345\275\225.md" index 5452b850..e3cf5afd 100644 --- "a/docs/\346\233\264\346\226\260\350\256\260\345\275\225.md" +++ "b/docs/\346\233\264\346\226\260\350\256\260\345\275\225.md" @@ -1,7 +1,14 @@ # 更新记录 +## 1.0.3 +2023-08-17 +- 修复了 FileStorageClientFactory 未自动加载的问题 +- 优化了 HuaweiObsFileStorage 的 ACL 转换方式,使其兼容低版本 SDK +- 修复了 GoogleCloudStorageFileStorage 的 ACL 转换时空指针问题 +- 修复了 又拍云 USS 的错误提示问题 + ## 1.0.2 -2023-08-08 +2023-08-09 - 修复了华为云 OBS 未加载的问题 ## 1.0.1 diff --git "a/docs/\350\204\261\347\246\273SpringBoot\345\215\225\347\213\254\344\275\277\347\224\250.md" "b/docs/\350\204\261\347\246\273SpringBoot\345\215\225\347\213\254\344\275\277\347\224\250.md" index 1bb1743c..96ee7c29 100644 --- "a/docs/\350\204\261\347\246\273SpringBoot\345\215\225\347\213\254\344\275\277\347\224\250.md" +++ "b/docs/\350\204\261\347\246\273SpringBoot\345\215\225\347\213\254\344\275\277\347\224\250.md" @@ -8,7 +8,7 @@ cn.xuyanwu file-storage-core - 1.0.2 + 1.0.3 ``` diff --git a/file-storage-core/pom.xml b/file-storage-core/pom.xml index 442eacf5..86823fc0 100644 --- a/file-storage-core/pom.xml +++ b/file-storage-core/pom.xml @@ -5,12 +5,12 @@ spring-file-storage-parent cn.xuyanwu - 1.0.2 + 1.0.3 4.0.0 file-storage-core - 1.0.2 + 1.0.3 8 diff --git a/file-storage-core/src/main/java/cn/xuyanwu/spring/file/storage/platform/GoogleCloudStorageFileStorage.java b/file-storage-core/src/main/java/cn/xuyanwu/spring/file/storage/platform/GoogleCloudStorageFileStorage.java index 1fe3513a..01d03643 100644 --- a/file-storage-core/src/main/java/cn/xuyanwu/spring/file/storage/platform/GoogleCloudStorageFileStorage.java +++ b/file-storage-core/src/main/java/cn/xuyanwu/spring/file/storage/platform/GoogleCloudStorageFileStorage.java @@ -130,8 +130,10 @@ public AclWrapper getAcl(Object acl) { } else if (acl instanceof String || acl == null) { String sAcl = (String) acl; if (StrUtil.isEmpty(sAcl)) sAcl = defaultAcl; + if (StrUtil.isEmpty(sAcl)) return null; + sAcl = sAcl.replace("-","_"); for (PredefinedAcl item : PredefinedAcl.values()) { - if (item.toString().equalsIgnoreCase(sAcl.replace("-","_"))) { + if (item.toString().equalsIgnoreCase(sAcl)) { return new AclWrapper(item); } } diff --git a/file-storage-core/src/main/java/cn/xuyanwu/spring/file/storage/platform/HuaweiObsFileStorage.java b/file-storage-core/src/main/java/cn/xuyanwu/spring/file/storage/platform/HuaweiObsFileStorage.java index 360f9e62..dc828e2e 100644 --- a/file-storage-core/src/main/java/cn/xuyanwu/spring/file/storage/platform/HuaweiObsFileStorage.java +++ b/file-storage-core/src/main/java/cn/xuyanwu/spring/file/storage/platform/HuaweiObsFileStorage.java @@ -1,7 +1,6 @@ package cn.xuyanwu.spring.file.storage.platform; import cn.hutool.core.io.IoUtil; -import cn.hutool.core.util.ReflectUtil; import cn.hutool.core.util.StrUtil; import cn.xuyanwu.spring.file.storage.FileInfo; import cn.xuyanwu.spring.file.storage.FileStorageProperties.HuaweiObsConfig; @@ -9,7 +8,7 @@ import cn.xuyanwu.spring.file.storage.UploadPretreatment; import cn.xuyanwu.spring.file.storage.exception.FileStorageRuntimeException; import com.obs.services.ObsClient; -import com.obs.services.internal.IConvertor; +import com.obs.services.internal.ObsConvertor; import com.obs.services.model.*; import lombok.Getter; import lombok.NoArgsConstructor; @@ -158,8 +157,8 @@ public AccessControlList getAcl(Object acl) { } else if (acl instanceof String || acl == null) { String sAcl = (String) acl; if (StrUtil.isEmpty(sAcl)) sAcl = defaultAcl; - IConvertor convertor = ReflectUtil.invoke(getClient(),"getIConvertor",bucketName); - return convertor.transCannedAcl(sAcl); + if (sAcl == null) return null; + return ObsConvertor.getInstance().transCannedAcl(sAcl); } else { throw new FileStorageRuntimeException("不支持的ACL:" + acl); } diff --git a/file-storage-core/src/main/java/cn/xuyanwu/spring/file/storage/platform/UpyunUssFileStorage.java b/file-storage-core/src/main/java/cn/xuyanwu/spring/file/storage/platform/UpyunUssFileStorage.java index d03d064d..e6028d89 100644 --- a/file-storage-core/src/main/java/cn/xuyanwu/spring/file/storage/platform/UpyunUssFileStorage.java +++ b/file-storage-core/src/main/java/cn/xuyanwu/spring/file/storage/platform/UpyunUssFileStorage.java @@ -69,7 +69,7 @@ public boolean save(FileInfo fileInfo,UploadPretreatment pre) { String newFileKey = getFileKey(fileInfo); fileInfo.setUrl(domain + newFileKey); if (fileInfo.getFileAcl() != null) { - throw new FileStorageRuntimeException("文件上传失败,七牛云 Kodo 不支持设置 ACL!platform:" + platform + ",filename:" + fileInfo.getOriginalFilename()); + throw new FileStorageRuntimeException("文件上传失败,又拍云 USS 不支持设置 ACL!platform:" + platform + ",filename:" + fileInfo.getOriginalFilename()); } ProgressListener listener = pre.getProgressListener(); diff --git a/pom.xml b/pom.xml index faf2b76d..736cac3f 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ cn.xuyanwu spring-file-storage-parent pom - 1.0.2 + 1.0.3 spring-file-storage-parent A File Storage Service @@ -63,7 +63,7 @@ cn.xuyanwu file-storage-core - 1.0.2 + 1.0.3 diff --git a/spring-file-storage-test/pom.xml b/spring-file-storage-test/pom.xml index d245ac3b..082e253f 100644 --- a/spring-file-storage-test/pom.xml +++ b/spring-file-storage-test/pom.xml @@ -12,7 +12,7 @@ cn.xuyanwu spring-file-storage-test - 1.0.2 + 1.0.3 spring-file-storage-test spring-file-storage 的测试和演示模块 @@ -145,7 +145,7 @@ cn.xuyanwu spring-file-storage - 1.0.2 + 1.0.3 diff --git a/spring-file-storage/pom.xml b/spring-file-storage/pom.xml index 45f3d0b5..86d37b93 100644 --- a/spring-file-storage/pom.xml +++ b/spring-file-storage/pom.xml @@ -5,7 +5,7 @@ spring-file-storage-parent cn.xuyanwu - 1.0.2 + 1.0.3 4.0.0 diff --git a/spring-file-storage/src/main/java/cn/xuyanwu/spring/file/storage/spring/FileStorageAutoConfiguration.java b/spring-file-storage/src/main/java/cn/xuyanwu/spring/file/storage/spring/FileStorageAutoConfiguration.java index 01178a89..7ff4393c 100644 --- a/spring-file-storage/src/main/java/cn/xuyanwu/spring/file/storage/spring/FileStorageAutoConfiguration.java +++ b/spring-file-storage/src/main/java/cn/xuyanwu/spring/file/storage/spring/FileStorageAutoConfiguration.java @@ -5,6 +5,7 @@ import cn.xuyanwu.spring.file.storage.aspect.FileStorageAspect; import cn.xuyanwu.spring.file.storage.file.FileWrapperAdapter; import cn.xuyanwu.spring.file.storage.platform.FileStorage; +import cn.xuyanwu.spring.file.storage.platform.FileStorageClientFactory; import cn.xuyanwu.spring.file.storage.recorder.DefaultFileRecorder; import cn.xuyanwu.spring.file.storage.recorder.FileRecorder; import cn.xuyanwu.spring.file.storage.spring.file.MultipartFileWrapperAdapter; @@ -93,13 +94,15 @@ public FileStorageService fileStorageService(FileRecorder fileRecorder, List> fileStorageLists, List aspectList, List fileWrapperAdapterList, - ContentTypeDetect contentTypeDetect) { + ContentTypeDetect contentTypeDetect, + List>> clientFactoryList) { FileStorageServiceBuilder builder = FileStorageServiceBuilder.create(properties.toFileStorageProperties()) .setFileRecorder(fileRecorder) .setAspectList(aspectList) .setContentTypeDetect(contentTypeDetect) - .setFileWrapperAdapterList(fileWrapperAdapterList); + .setFileWrapperAdapterList(fileWrapperAdapterList) + .setClientFactoryList(clientFactoryList); fileStorageLists.forEach(builder::addFileStorage);