Skip to content

Commit

Permalink
Merge pull request #107 from 1171736840/dev
Browse files Browse the repository at this point in the history
Release 1.0.3
  • Loading branch information
1171736840 authored Aug 17, 2023
2 parents 44d7192 + ed51143 commit 11e4d1c
Show file tree
Hide file tree
Showing 15 changed files with 40 additions and 23 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
<br />
`1.0.2` 修复了华为云 OBS 未加载的问题,查看 [更新记录](https://spring-file-storage.xuyanwu.cn/#/更新记录?id=102)
<br />
`1.0.1` 修复了 MultipartFile 无法正确获取文件名等问题,查看 [更新记录](https://spring-file-storage.xuyanwu.cn/#/更新记录?id=101)
Expand Down
2 changes: 2 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ Amazon S3、GoogleCloud Storage、金山云 KS3、美团云 MSS、京东云 OSS

后续即将支持 Samba、NFS

`1.0.3` 修复了 FileStorageClientFactory 未自动加载等问题,查看 [更新记录](更新记录?id=103)
<br />
`1.0.2` 修复了华为云 OBS 未加载的问题,查看 [更新记录](更新记录?id=102)
<br />
`1.0.1` 修复了 MultipartFile 无法正确获取文件名等问题,查看 [更新记录](更新记录?id=101)
Expand Down
4 changes: 3 additions & 1 deletion docs/_navbar.md
Original file line number Diff line number Diff line change
@@ -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/)
Expand Down
8 changes: 4 additions & 4 deletions docs/存储平台.md
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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 工厂类就可以了,不用重新自定义整个存储平台,在后续文档中会详细说明
Expand Down Expand Up @@ -467,7 +467,7 @@ spring:
@Bean
public List<FileStorageClientFactory<?>> myHuaweiObsFileStorageClientFactory(SpringFileStorageProperties properties) {
return properties.getHuaweiObs().stream()
.filter(SpringHuaweiObsConfigConfig::getEnableStorage)
.filter(SpringHuaweiObsConfig::getEnableStorage)
.map(config -> new FileStorageClientFactory<ObsClient>() {
private volatile ObsClient client;

Expand Down
2 changes: 1 addition & 1 deletion docs/快速入门.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<dependency>
<groupId>cn.xuyanwu</groupId>
<artifactId>spring-file-storage</artifactId>
<version>1.0.2</version>
<version>1.0.3</version>
</dependency>
```

Expand Down
9 changes: 8 additions & 1 deletion docs/更新记录.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/脱离SpringBoot单独使用.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<dependency>
<groupId>cn.xuyanwu</groupId>
<artifactId>file-storage-core</artifactId>
<version>1.0.2</version>
<version>1.0.3</version>
</dependency>
```

Expand Down
4 changes: 2 additions & 2 deletions file-storage-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
<parent>
<artifactId>spring-file-storage-parent</artifactId>
<groupId>cn.xuyanwu</groupId>
<version>1.0.2</version>
<version>1.0.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>file-storage-core</artifactId>
<version>1.0.2</version>
<version>1.0.3</version>

<properties>
<maven.compiler.source>8</maven.compiler.source>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
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;
import cn.xuyanwu.spring.file.storage.ProgressListener;
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;
Expand Down Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>cn.xuyanwu</groupId>
<artifactId>spring-file-storage-parent</artifactId>
<packaging>pom</packaging>
<version>1.0.2</version>
<version>1.0.3</version>

<name>spring-file-storage-parent</name>
<description>A File Storage Service</description>
Expand Down Expand Up @@ -63,7 +63,7 @@
<dependency>
<groupId>cn.xuyanwu</groupId>
<artifactId>file-storage-core</artifactId>
<version>1.0.2</version>
<version>1.0.3</version>
</dependency>
<!-- Apache commons-pool2 -->
<dependency>
Expand Down
4 changes: 2 additions & 2 deletions spring-file-storage-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<groupId>cn.xuyanwu</groupId>
<artifactId>spring-file-storage-test</artifactId>
<version>1.0.2</version>
<version>1.0.3</version>
<name>spring-file-storage-test</name>
<description>spring-file-storage 的测试和演示模块</description>

Expand Down Expand Up @@ -145,7 +145,7 @@
<dependency>
<groupId>cn.xuyanwu</groupId>
<artifactId>spring-file-storage</artifactId>
<version>1.0.2</version>
<version>1.0.3</version>
</dependency>

<dependency>
Expand Down
2 changes: 1 addition & 1 deletion spring-file-storage/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>spring-file-storage-parent</artifactId>
<groupId>cn.xuyanwu</groupId>
<version>1.0.2</version>
<version>1.0.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -93,13 +94,15 @@ public FileStorageService fileStorageService(FileRecorder fileRecorder,
List<List<? extends FileStorage>> fileStorageLists,
List<FileStorageAspect> aspectList,
List<FileWrapperAdapter> fileWrapperAdapterList,
ContentTypeDetect contentTypeDetect) {
ContentTypeDetect contentTypeDetect,
List<List<FileStorageClientFactory<?>>> clientFactoryList) {

FileStorageServiceBuilder builder = FileStorageServiceBuilder.create(properties.toFileStorageProperties())
.setFileRecorder(fileRecorder)
.setAspectList(aspectList)
.setContentTypeDetect(contentTypeDetect)
.setFileWrapperAdapterList(fileWrapperAdapterList);
.setFileWrapperAdapterList(fileWrapperAdapterList)
.setClientFactoryList(clientFactoryList);

fileStorageLists.forEach(builder::addFileStorage);

Expand Down

0 comments on commit 11e4d1c

Please sign in to comment.