From 431fdbc974ec7c6d6306a619742c7ef20031782a Mon Sep 17 00:00:00 2001 From: xuyanwu <1171736840@qq.com> Date: Sat, 14 Oct 2023 15:50:17 +0800 Subject: [PATCH 1/3] =?UTF-8?q?Update:=E4=BC=98=E5=8C=96=20ACL=20=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/acl.md | 20 +++++++++++++++++++ ...64\346\226\260\350\256\260\345\275\225.md" | 1 + .../storage/core/FileStorageProperties.java | 4 ++++ .../file/storage/core/FileStorageService.java | 2 ++ .../core/FileStorageServiceBuilder.java | 1 + .../file/storage/core/UploadPretreatment.java | 5 +++++ .../storage/core/platform/FtpFileStorage.java | 2 +- .../core/platform/LocalFileStorage.java | 2 +- .../core/platform/LocalPlusFileStorage.java | 2 +- .../core/platform/MinioFileStorage.java | 2 +- .../core/platform/QiniuKodoFileStorage.java | 2 +- .../core/platform/SftpFileStorage.java | 2 +- .../core/platform/UpyunUssFileStorage.java | 2 +- .../core/platform/WebDavFileStorage.java | 2 +- .../spring/SpringFileStorageProperties.java | 5 +++++ 15 files changed, 46 insertions(+), 8 deletions(-) diff --git a/docs/acl.md b/docs/acl.md index b8b2b00f..010ae831 100644 --- a/docs/acl.md +++ b/docs/acl.md @@ -132,3 +132,23 @@ ObsClient client = fileStorage.getClient(); AccessControlList acl = client.getObjectAcl(fileStorage.getBucketName(),fileStorage.getFileKey(fileInfo)); ``` 因为这种方式使用较少,且每个平台返回的的 ACL 都不一样,所以就没有封装统一的方法,一般情况下从`FileInfo`对象直接获取就行了 + + +## 处理异常 + +默认在不支持的存储平台传入 ACL 会抛出异常,可以通过以下方式不抛出异常 + +**第一种(全局)** +```yaml +spring: + file-storage: + upload-not-support-alc-throw-exception: false +``` + +**第二种(仅当前)** +```java +FileInfo fileInfo = fileStorageService.of(file) + .setNotSupportAclThrowException(false) //在不支持 ACL 的存储平台不抛出异常 + .setAcl(Constant.ACL.PRIVATE) + .upload(); +``` 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 372e72ac..c1275e25 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" @@ -6,6 +6,7 @@ 2023-09-21 - 更改项目名、更改包名、优化项目结构 - 支持 Metadata 元数据 +- 优化 ACL 异常处理 - 捐赠至 [dromara](https://dromara.org/zh) 开源社区 ------- diff --git a/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/FileStorageProperties.java b/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/FileStorageProperties.java index 8a698f55..f819c67c 100644 --- a/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/FileStorageProperties.java +++ b/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/FileStorageProperties.java @@ -30,6 +30,10 @@ public class FileStorageProperties { * 上传时不支持元数据时抛出异常 */ private Boolean uploadNotSupportMetadataThrowException = true; + /** + * 上传时不支持 ACL 时抛出异常 + */ + private Boolean uploadNotSupportAclThrowException = true; /** * 本地存储 */ diff --git a/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/FileStorageService.java b/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/FileStorageService.java index e7aa51f4..e1f1d42c 100644 --- a/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/FileStorageService.java +++ b/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/FileStorageService.java @@ -38,6 +38,7 @@ public class FileStorageService { private String defaultPlatform; private String thumbnailSuffix; private Boolean uploadNotSupportMetadataThrowException; + private Boolean uploadNotSupportAclThrowException; private CopyOnWriteArrayList aspectList; private CopyOnWriteArrayList fileWrapperAdapterList; private ContentTypeDetect contentTypeDetect; @@ -333,6 +334,7 @@ public UploadPretreatment of() { pre.setPlatform(defaultPlatform); pre.setThumbnailSuffix(thumbnailSuffix); pre.setNotSupportMetadataThrowException(uploadNotSupportMetadataThrowException); + pre.setNotSupportAclThrowException(uploadNotSupportAclThrowException); return pre; } diff --git a/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/FileStorageServiceBuilder.java b/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/FileStorageServiceBuilder.java index 2d3b391d..44b57d41 100644 --- a/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/FileStorageServiceBuilder.java +++ b/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/FileStorageServiceBuilder.java @@ -262,6 +262,7 @@ public FileStorageService build() { service.setDefaultPlatform(properties.getDefaultPlatform()); service.setThumbnailSuffix(properties.getThumbnailSuffix()); service.setUploadNotSupportMetadataThrowException(properties.getUploadNotSupportMetadataThrowException()); + service.setUploadNotSupportAclThrowException(properties.getUploadNotSupportAclThrowException()); service.setAspectList(new CopyOnWriteArrayList<>(aspectList)); service.setFileWrapperAdapterList(new CopyOnWriteArrayList<>(fileWrapperAdapterList)); service.setContentTypeDetect(contentTypeDetect); diff --git a/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/UploadPretreatment.java b/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/UploadPretreatment.java index 58851c85..ae0f5fe8 100644 --- a/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/UploadPretreatment.java +++ b/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/UploadPretreatment.java @@ -99,6 +99,11 @@ public class UploadPretreatment { */ private Boolean notSupportMetadataThrowException; + /** + * 不支持 ACL 时抛出异常 + */ + private Boolean notSupportAclThrowException; + /** * 附加属性字典 */ diff --git a/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/platform/FtpFileStorage.java b/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/platform/FtpFileStorage.java index 090538a9..962196be 100644 --- a/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/platform/FtpFileStorage.java +++ b/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/platform/FtpFileStorage.java @@ -81,7 +81,7 @@ public boolean save(FileInfo fileInfo,UploadPretreatment pre) { fileInfo.setBasePath(basePath); String newFileKey = getFileKey(fileInfo); fileInfo.setUrl(domain + newFileKey); - if (fileInfo.getFileAcl() != null) { + if (fileInfo.getFileAcl() != null && pre.getNotSupportAclThrowException()) { throw new FileStorageRuntimeException("文件上传失败,FTP 不支持设置 ACL!platform:" + platform + ",filename:" + fileInfo.getOriginalFilename()); } if (CollUtil.isNotEmpty(fileInfo.getUserMetadata()) && pre.getNotSupportMetadataThrowException()) { diff --git a/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/platform/LocalFileStorage.java b/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/platform/LocalFileStorage.java index c658abc6..603aca7b 100644 --- a/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/platform/LocalFileStorage.java +++ b/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/platform/LocalFileStorage.java @@ -44,7 +44,7 @@ public boolean save(FileInfo fileInfo,UploadPretreatment pre) { File newFile = FileUtil.touch(basePath + path,fileInfo.getFilename()); fileInfo.setBasePath(basePath); fileInfo.setUrl(domain + path + fileInfo.getFilename()); - if (fileInfo.getFileAcl() != null) { + if (fileInfo.getFileAcl() != null && pre.getNotSupportAclThrowException()) { throw new FileStorageRuntimeException("文件上传失败,LocalFile 不支持设置 ACL!platform:" + platform + ",filename:" + fileInfo.getOriginalFilename()); } if (CollUtil.isNotEmpty(fileInfo.getUserMetadata()) && pre.getNotSupportMetadataThrowException()) { diff --git a/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/platform/LocalPlusFileStorage.java b/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/platform/LocalPlusFileStorage.java index de6ce6ca..a8e5e5dd 100644 --- a/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/platform/LocalPlusFileStorage.java +++ b/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/platform/LocalPlusFileStorage.java @@ -60,7 +60,7 @@ public boolean save(FileInfo fileInfo,UploadPretreatment pre) { fileInfo.setBasePath(basePath); String newFileKey = getFileKey(fileInfo); fileInfo.setUrl(domain + newFileKey); - if (fileInfo.getFileAcl() != null) { + if (fileInfo.getFileAcl() != null && pre.getNotSupportAclThrowException()) { throw new FileStorageRuntimeException("文件上传失败,LocalFile 不支持设置 ACL!platform:" + platform + ",filename:" + fileInfo.getOriginalFilename()); } if (CollUtil.isNotEmpty(fileInfo.getUserMetadata()) && pre.getNotSupportMetadataThrowException()) { diff --git a/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/platform/MinioFileStorage.java b/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/platform/MinioFileStorage.java index 2d1fe0c8..c4dd745d 100644 --- a/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/platform/MinioFileStorage.java +++ b/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/platform/MinioFileStorage.java @@ -67,7 +67,7 @@ public boolean save(FileInfo fileInfo,UploadPretreatment pre) { fileInfo.setBasePath(basePath); String newFileKey = getFileKey(fileInfo); fileInfo.setUrl(domain + newFileKey); - if (fileInfo.getFileAcl() != null) { + if (fileInfo.getFileAcl() != null && pre.getNotSupportAclThrowException()) { throw new FileStorageRuntimeException("文件上传失败,MinIO 不支持设置 ACL!platform:" + platform + ",filename:" + fileInfo.getOriginalFilename()); } ProgressListener listener = pre.getProgressListener(); diff --git a/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/platform/QiniuKodoFileStorage.java b/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/platform/QiniuKodoFileStorage.java index e9a80852..43190553 100644 --- a/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/platform/QiniuKodoFileStorage.java +++ b/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/platform/QiniuKodoFileStorage.java @@ -70,7 +70,7 @@ public boolean save(FileInfo fileInfo,UploadPretreatment pre) { fileInfo.setBasePath(basePath); String newFileKey = getFileKey(fileInfo); fileInfo.setUrl(domain + newFileKey); - if (fileInfo.getFileAcl() != null) { + if (fileInfo.getFileAcl() != null && pre.getNotSupportAclThrowException()) { throw new FileStorageRuntimeException("文件上传失败,七牛云 Kodo 不支持设置 ACL!platform:" + platform + ",filename:" + fileInfo.getOriginalFilename()); } ProgressListener listener = pre.getProgressListener(); diff --git a/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/platform/SftpFileStorage.java b/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/platform/SftpFileStorage.java index b264df88..a2afa51f 100644 --- a/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/platform/SftpFileStorage.java +++ b/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/platform/SftpFileStorage.java @@ -83,7 +83,7 @@ public boolean save(FileInfo fileInfo,UploadPretreatment pre) { fileInfo.setBasePath(basePath); String newFileKey = getFileKey(fileInfo); fileInfo.setUrl(domain + newFileKey); - if (fileInfo.getFileAcl() != null) { + if (fileInfo.getFileAcl() != null && pre.getNotSupportAclThrowException()) { throw new FileStorageRuntimeException("文件上传失败,SFTP 不支持设置 ACL!platform:" + platform + ",filename:" + fileInfo.getOriginalFilename()); } if (CollUtil.isNotEmpty(fileInfo.getUserMetadata()) && pre.getNotSupportMetadataThrowException()) { diff --git a/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/platform/UpyunUssFileStorage.java b/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/platform/UpyunUssFileStorage.java index ad42db4d..802d27a5 100644 --- a/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/platform/UpyunUssFileStorage.java +++ b/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/platform/UpyunUssFileStorage.java @@ -69,7 +69,7 @@ public boolean save(FileInfo fileInfo,UploadPretreatment pre) { fileInfo.setBasePath(basePath); String newFileKey = getFileKey(fileInfo); fileInfo.setUrl(domain + newFileKey); - if (fileInfo.getFileAcl() != null) { + if (fileInfo.getFileAcl() != null && pre.getNotSupportAclThrowException()) { throw new FileStorageRuntimeException("文件上传失败,又拍云 USS 不支持设置 ACL!platform:" + platform + ",filename:" + fileInfo.getOriginalFilename()); } ProgressListener listener = pre.getProgressListener(); diff --git a/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/platform/WebDavFileStorage.java b/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/platform/WebDavFileStorage.java index d5b95da5..9931253b 100644 --- a/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/platform/WebDavFileStorage.java +++ b/x-file-storage-core/src/main/java/org/dromara/x/file/storage/core/platform/WebDavFileStorage.java @@ -93,7 +93,7 @@ public boolean save(FileInfo fileInfo,UploadPretreatment pre) { fileInfo.setBasePath(basePath); String newFileKey = getFileKey(fileInfo); fileInfo.setUrl(domain + newFileKey); - if (fileInfo.getFileAcl() != null) { + if (fileInfo.getFileAcl() != null && pre.getNotSupportAclThrowException()) { throw new FileStorageRuntimeException("文件上传失败,WebDAV 不支持设置 ACL!platform:" + platform + ",filename:" + fileInfo.getOriginalFilename()); } if (CollUtil.isNotEmpty(fileInfo.getUserMetadata()) && pre.getNotSupportMetadataThrowException()) { diff --git a/x-file-storage-spring/src/main/java/org/dromara/x/file/storage/spring/SpringFileStorageProperties.java b/x-file-storage-spring/src/main/java/org/dromara/x/file/storage/spring/SpringFileStorageProperties.java index 7cd71275..7539e3fe 100644 --- a/x-file-storage-spring/src/main/java/org/dromara/x/file/storage/spring/SpringFileStorageProperties.java +++ b/x-file-storage-spring/src/main/java/org/dromara/x/file/storage/spring/SpringFileStorageProperties.java @@ -30,6 +30,10 @@ public class SpringFileStorageProperties { * 上传时不支持元数据时抛出异常 */ private Boolean uploadNotSupportMetadataThrowException = true; + /** + * 上传时不支持 ACL 时抛出异常 + */ + private Boolean uploadNotSupportAclThrowException = true; /** * 启用 byte[] 文件包装适配器 */ @@ -125,6 +129,7 @@ public FileStorageProperties toFileStorageProperties() { properties.setDefaultPlatform(defaultPlatform); properties.setThumbnailSuffix(thumbnailSuffix); properties.setUploadNotSupportMetadataThrowException(uploadNotSupportMetadataThrowException); + properties.setUploadNotSupportAclThrowException(uploadNotSupportAclThrowException); properties.setLocal(local.stream().filter(SpringLocalConfig::getEnableStorage).collect(Collectors.toList())); properties.setLocalPlus(localPlus.stream().filter(SpringLocalPlusConfig::getEnableStorage).collect(Collectors.toList())); properties.setHuaweiObs(huaweiObs.stream().filter(SpringHuaweiObsConfig::getEnableStorage).collect(Collectors.toList())); From 10b2e52f772621eef146a0242962f61bce5e6c54 Mon Sep 17 00:00:00 2001 From: xuyanwu <1171736840@qq.com> Date: Mon, 16 Oct 2023 14:18:56 +0800 Subject: [PATCH 2/3] =?UTF-8?q?Update:=E4=BF=AE=E6=94=B9=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E5=89=8D=E7=BC=80=E3=80=81=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 10 +-- docs/Metadata.md | 4 +- docs/README.md | 7 +- docs/acl.md | 4 +- ...30\345\202\250\345\271\263\345\217\260.md" | 4 +- ...53\351\200\237\345\205\245\351\227\250.md" | 11 ++-- ...66\351\200\202\351\205\215\345\231\250.md" | 4 +- ...64\346\226\260\350\256\260\345\275\225.md" | 64 ++++++++++++++++++- .../spring/SpringFileStorageProperties.java | 2 +- .../src/main/resources/application.yml | 3 +- 10 files changed, 89 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 3644bc56..2c357e4a 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ Gitee:https://gitee.com/dromara/x-file-storage 这里是简要的更新记录,查看 [详细的更新记录](https://x-file-storage.xuyanwu.cn/#/更新记录) -`2.0.0` 更改项目名、包名,优化项目结构、捐赠至 [dromara](https://dromara.org/zh) 开源社区,查看 [更新记录](https://x-file-storage.xuyanwu.cn/#/更新记录?id=_200) +`2.0.0` 捐赠至 [dromara](https://dromara.org/zh) 开源社区,更改项目名、包名,优化项目结构、支持 Metadata 元数据等,从旧版升级需要注意,详情查看 [更新记录](https://x-file-storage.xuyanwu.cn/#/更新记录?id=_200)
`1.0.3` 修复了 FileStorageClientFactory 未自动加载等问题,查看 [更新记录](https://x-file-storage.xuyanwu.cn/#/更新记录?id=_103)
@@ -66,11 +66,11 @@ Gitee:https://gitee.com/dromara/x-file-storage ### 📅更新计划 - 接入存储平台:HDFS、FastDFS、杉岩 OBS、Samba、NFS -- 大文件手动分片上传 +- 大文件手动分片上传(1.0.0 已支持大文件自动分片上传) - 复制或移动文件 - 文件内容预加载 - 上传无需强制获取 Size -- 新增 Access 模块,通过 HTTP、FTP、WebDAV 等协议对外提供接口,方便其它程序使用 +- 新增 Access 模块,尝试通过 HTTP、FTP、WebDAV 等协议对外提供接口,方便其它程序使用 ------- @@ -100,8 +100,8 @@ Gitee:https://gitee.com/dromara/x-file-storage `application.yml` 配置文件中添加以下基础配置 ```yaml -spring: - file-storage: #文件存储配置 +dromara: + x-file-storage: #文件存储配置 default-platform: aliyun-oss-1 #默认使用的存储平台 aliyun-oss: - platform: aliyun-oss-1 # 存储平台标识 diff --git a/docs/Metadata.md b/docs/Metadata.md index 641cb0ae..f51fef15 100644 --- a/docs/Metadata.md +++ b/docs/Metadata.md @@ -32,8 +32,8 @@ FileInfo fileInfo = fileStorageService.of(file) **第一种(全局)** ```yaml -spring: - file-storage: +dromara: + x-file-storage: upload-not-support-metadata-throw-exception: false ``` diff --git a/docs/README.md b/docs/README.md index dac023cc..ec2208ce 100644 --- a/docs/README.md +++ b/docs/README.md @@ -50,8 +50,7 @@ Gitee:https://gitee.com/dromara/x-file-storage # 📜更新记录 这里是简要的更新记录,查看 [详细的更新记录](更新记录) - -`2.0.0` 更改项目名、包名,优化项目结构、捐赠至 [dromara](https://dromara.org/zh) 开源社区,查看 [更新记录](更新记录?id=_200) +`2.0.0` 捐赠至 [dromara](https://dromara.org/zh) 开源社区,更改项目名、包名,优化项目结构、支持 Metadata 元数据等,从旧版升级需要注意,详情查看 [更新记录](更新记录?id=_200)
`1.0.3` 修复了 FileStorageClientFactory 未自动加载等问题,查看 [更新记录](更新记录?id=_103)
@@ -66,11 +65,11 @@ Gitee:https://gitee.com/dromara/x-file-storage # 📅更新计划 - 接入存储平台:HDFS、FastDFS、杉岩 OBS、Samba、NFS -- 大文件手动分片上传 +- 大文件手动分片上传(1.0.0 已支持大文件自动分片上传) - 复制或移动文件 - 文件内容预加载 - 上传无需强制获取 Size -- 新增 Access 模块,通过 HTTP、FTP、WebDAV 等协议对外提供接口,方便其它程序使用 +- 新增 Access 模块,尝试通过 HTTP、FTP、WebDAV 等协议对外提供接口,方便其它程序使用 ------- diff --git a/docs/acl.md b/docs/acl.md index 010ae831..e125c0fc 100644 --- a/docs/acl.md +++ b/docs/acl.md @@ -140,8 +140,8 @@ AccessControlList acl = client.getObjectAcl(fileStorage.getBucketName(),fileStor **第一种(全局)** ```yaml -spring: - file-storage: +dromara: + x-file-storage: upload-not-support-alc-throw-exception: false ``` 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 723aeb70..66edbcc6 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" @@ -437,8 +437,8 @@ public List myHuaweiObsFileStorageList() { 这里拿 华为云 OBS 举例 ,先配置我们需要用到的自定义参数 ```yaml -spring: - file-storage: #文件存储配置 +dromara: + x-file-storage: #文件存储配置 default-platform: huawei-obs-1 #默认使用的存储平台 thumbnail-suffix: ".min.jpg" #缩略图后缀,例如【.min.jpg】【.png】 huawei-obs: 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 28194617..9c99ec6b 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" @@ -2,6 +2,9 @@ ## 配置 +> [!WARNING|label:重要提示:] +> 如果是旧版本升级需要注意:从 2.0.0 版本开始,因为更换了项目名称及结构,导致依赖名称、配置文件参数名及包名与之前版本有所不同,详情查看 [更新记录](更新记录?id=_200) + `pom.xml` 引入本项目,这里默认是 `SpringBoot` 环境,其它环境参考 [脱离 SpringBoot 单独使用](脱离SpringBoot单独使用) ```xml @@ -184,8 +187,8 @@ `application.yml` 配置文件中先添加以下基础配置 ```yaml -spring: - file-storage: #文件存储配置 +dromara: + x-file-storage: #文件存储配置 default-platform: huawei-obs-1 #默认使用的存储平台 thumbnail-suffix: ".min.jpg" #缩略图后缀,例如【.min.jpg】【.png】 #对应平台的配置写在这里,注意缩进要对齐 @@ -428,8 +431,8 @@ local-plus: ```yaml -spring: - file-storage: #文件存储配置 +dromara: + x-file-storage: #文件存储配置 default-platform: huawei-obs-1 #默认使用的存储平台 thumbnail-suffix: ".min.jpg" #缩略图后缀,例如【.min.jpg】【.png】 huawei-obs: diff --git "a/docs/\346\226\207\344\273\266\351\200\202\351\205\215\345\231\250.md" "b/docs/\346\226\207\344\273\266\351\200\202\351\205\215\345\231\250.md" index cb54e5a1..0a27810b 100644 --- "a/docs/\346\226\207\344\273\266\351\200\202\351\205\215\345\231\250.md" +++ "b/docs/\346\226\207\344\273\266\351\200\202\351\205\215\345\231\250.md" @@ -9,8 +9,8 @@ 先在配置文件里禁用自带的 byte[] 文件适配器,防止和这里自定义的 byte[] 文件适配器冲突 ```yaml -spring: - file-storage: +dromara: + x-file-storage: enable-byte-file-wrapper: false ``` 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 c1275e25..ea058488 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" @@ -5,10 +5,72 @@ ## 📦2.0.0 :id=_200 2023-09-21 - 更改项目名、更改包名、优化项目结构 -- 支持 Metadata 元数据 +- 新增直接读取 HttpServletRequest 的流进行上传,文件不落盘,速度更快 +- 新增支持 Metadata 元数据 - 优化 ACL 异常处理 +- 修复 Amazon S3 上传文件偶现 ResetException 问题 - 捐赠至 [dromara](https://dromara.org/zh) 开源社区 +#### 项目依赖的变化 + +2.0.0 之前的版本 + +```xml + + cn.xuyanwu + spring-file-storage + 1.0.3 + +``` + +2.0.0 及以后的版本 + +```xml + + org.dromara + x-file-storage-spring + 2.0.0 + +``` + +#### 配置参数的变化 + +2.0.0 之前的版本 + +```yaml +spring: + file-storage: #文件存储配置 + default-platform: huawei-obs-1 #默认使用的存储平台 + thumbnail-suffix: ".min.jpg" #缩略图后缀,例如【.min.jpg】【.png】 + #对应平台的配置写在这里,注意缩进要对齐 +``` + +2.0.0 及以后的版本 + +```yaml +dromara: + x-file-storage: #文件存储配置 + default-platform: huawei-obs-1 #默认使用的存储平台 + thumbnail-suffix: ".min.jpg" #缩略图后缀,例如【.min.jpg】【.png】 + #对应平台的配置写在这里,注意缩进要对齐 +``` + +#### 包名的变化 + +2.0.0 之前的版本 + +```java +cn.xuyanwu.spring.file.storage +cn.xuyanwu.spring.file.storage.spring +``` + +2.0.0 及以后的版本 + +```java +org.dromara.x.file.storage.core +org.dromara.x.file.storage.spring +``` + ------- ## 📦1.0.3 :id=_103 diff --git a/x-file-storage-spring/src/main/java/org/dromara/x/file/storage/spring/SpringFileStorageProperties.java b/x-file-storage-spring/src/main/java/org/dromara/x/file/storage/spring/SpringFileStorageProperties.java index 7539e3fe..0ba4b642 100644 --- a/x-file-storage-spring/src/main/java/org/dromara/x/file/storage/spring/SpringFileStorageProperties.java +++ b/x-file-storage-spring/src/main/java/org/dromara/x/file/storage/spring/SpringFileStorageProperties.java @@ -15,7 +15,7 @@ @Data @Component @ConditionalOnMissingBean(SpringFileStorageProperties.class) -@ConfigurationProperties(prefix = "spring.file-storage") +@ConfigurationProperties(prefix = "dromara.x-file-storage") public class SpringFileStorageProperties { /** diff --git a/x-file-storage-test/src/main/resources/application.yml b/x-file-storage-test/src/main/resources/application.yml index e28272c0..8d3695c8 100644 --- a/x-file-storage-test/src/main/resources/application.yml +++ b/x-file-storage-test/src/main/resources/application.yml @@ -15,7 +15,8 @@ spring: multipart: resolve-lazily: true # multipart 懒加载 - file-storage: #文件存储配置,不使用的情况下可以不写 +dromara: + x-file-storage: #文件存储配置,不使用的情况下可以不写 default-platform: local-plus-1 #默认使用的存储平台 thumbnail-suffix: ".min.jpg" #缩略图后缀,例如【.min.jpg】【.png】 local: # 本地存储(不推荐使用) From cd2291800e1ccc4a2579d62dc63ea6c5e557efbe Mon Sep 17 00:00:00 2001 From: xuyanwu <1171736840@qq.com> Date: Mon, 16 Oct 2023 18:04:39 +0800 Subject: [PATCH 3/3] =?UTF-8?q?Update:=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/README.md | 170 ++++++++++++++++++++++++++++++++++++++++++++++++ docs/index.html | 11 +--- 2 files changed, 171 insertions(+), 10 deletions(-) diff --git a/docs/README.md b/docs/README.md index ec2208ce..a2e8f5e1 100644 --- a/docs/README.md +++ b/docs/README.md @@ -50,6 +50,7 @@ Gitee:https://gitee.com/dromara/x-file-storage # 📜更新记录 这里是简要的更新记录,查看 [详细的更新记录](更新记录) + `2.0.0` 捐赠至 [dromara](https://dromara.org/zh) 开源社区,更改项目名、包名,优化项目结构、支持 Metadata 元数据等,从旧版升级需要注意,详情查看 [更新记录](更新记录?id=_200)
`1.0.3` 修复了 FileStorageClientFactory 未自动加载等问题,查看 [更新记录](更新记录?id=_103) @@ -129,6 +130,175 @@ X File Storage 感谢各位小伙伴的信任与支持,如果您已经在项 ------- +# 🚀Dromara成员项目 + + + + +为往圣继绝学,一个人或许能走的更快,但一群人会走的更远。 + +下载本项目 logo 合集 + +------- + # 🌏知识星球 知识星球 diff --git a/docs/index.html b/docs/index.html index ddafb559..a33875dd 100644 --- a/docs/index.html +++ b/docs/index.html @@ -20,16 +20,7 @@ font-weight: bold; } - .app-name { - margin: 0 !important; - height: 140px; - overflow: hidden; - } - .app-name img { - margin-top: -15px; - max-width: 75%; - } @@ -41,7 +32,7 @@ loadFooter: true, subMaxLevel: 3, name: 'X File Storage', - logo: 'https://x-file-storage.xuyanwu.cn/assets/logo.svg', + logo: 'https://x-file-storage.xuyanwu.cn/assets/logo2.svg', repo: 'https://github.com/dromara/x-file-storage', auto2top: true, search: {