Skip to content

Commit

Permalink
Merge pull request #277 from dromara/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
1171736840 authored Jul 18, 2024
2 parents efe25a3 + 266f7b5 commit acef725
Show file tree
Hide file tree
Showing 21 changed files with 187 additions and 36 deletions.
11 changes: 11 additions & 0 deletions .gitee/ISSUE_TEMPLATE/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
blank_issues_enabled: false
contact_links:
- name: 官方文档
url: https://x-file-storage.xuyanwu.cn/
about: 提供使用指南、教程、功能使用、介绍和常见问题解答
- name: 常见问题
url: https%3A%2F%2Fx-file-storage.xuyanwu.cn%2F%23%2F%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98
about: 提供常见问题解答
- name: 加入QQ群 515706495
url: "https%3A%2F%2Fjq.qq.com%2F%3F_wv%3D1027%26k%3DeGfeNqka"
about: 一起交流
43 changes: 43 additions & 0 deletions .gitee/ISSUE_TEMPLATE/feature.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: 功能建议
description: 对本项目提出一个功能建议
title: "[功能建议]: "
labels: ["enhancement"]
body:
- type: markdown
attributes:
value: |
感谢提出功能建议,我们将仔细考虑!
- type: textarea
id: related-problem
attributes:
label: 你的功能建议是否和某个问题相关?
description: 清晰并简洁地描述问题是什么,例如,当我...时,我总是感到困扰。
validations:
required: false
- type: textarea
id: desired-solution
attributes:
label: 你希望看到什么解决方案?
description: 清晰并简洁地描述你希望发生的事情。
validations:
required: true
- type: textarea
id: alternatives
attributes:
label: 你考虑过哪些替代方案?
description: 清晰并简洁地描述你考虑过的任何替代解决方案或功能。
validations:
required: false
- type: textarea
id: additional-context
attributes:
label: 你有其他上下文或截图吗?
description: 在此处添加有关功能请求的任何其他上下文或截图。
validations:
required: false
- type: checkboxes
attributes:
label: 意向参与贡献
options:
- label: 我有意向参与具体功能的开发实现并将代码贡献回到上游社区
required: false
68 changes: 68 additions & 0 deletions .gitee/ISSUE_TEMPLATE/question.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: 问题反馈
description: 在使用时遇到一些问题
title: "[问题反馈]: "
labels: ["question"]
body:
- type: markdown
attributes:
value: |
感谢对项目的支持与关注。在提出问题之前,请确保你已查看相关开发或使用文档:
- [官方文档](https://x-file-storage.xuyanwu.cn/)
- [常见问题](https://x-file-storage.xuyanwu.cn/#/%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98)
- type: checkboxes
attributes:
label: 这个问题是否已经存在?
options:
- label: 我已经搜索过现有的问题 (https://gitee.com/../../issues)
required: true
- type: textarea
attributes:
label: 相关依赖及版本号
description: 请详细输入用到的相关依赖及版本号
value: |
X File Storage 版本号:
SpringBoot 版本号:
Solon 版本号:
JVM 版本号:
其它依赖的名称及版本号:
validations:
required: true
- type: textarea
attributes:
label: 配置文件
description: 输入你的配置文件,IP、密钥等使用 xxx 代替
value: |
```yaml
# 在此输入配置文件
```
validations:
required: true
- type: textarea
attributes:
label: 复现代码
description: 请详细告诉我们如何复现你遇到的问题,如涉及代码,可提供一个最小代码示例,并使用反引号```附上它
placeholder: |
1. ...
2. ...
3. ...
validations:
required: true
- type: textarea
attributes:
label: 预期结果
description: 请告诉我们你预期会发生什么。
validations:
required: true
- type: textarea
attributes:
label: 实际结果或详细的报错信息
description: 请告诉我们实际发生了什么。
validations:
required: true
- type: textarea
attributes:
label: 截图或视频
description: 如果可以的话,上传任何关于 bug 的截图。
value: |
[在这里上传图片]
12 changes: 3 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,13 @@ Gitee:https://gitee.com/dromara/x-file-storage

这里是简要的更新记录,查看 [详细的更新记录](https://x-file-storage.xuyanwu.cn/#/更新记录)

`2.2.1` 修复某些情况下哈希计算错误的问题、七牛云 Kodo 预签名 URL 无法使用的问题 [更新记录](https://x-file-storage.xuyanwu.cn/#/更新记录?id=_221)
<br />
`2.2.0` 修复大量问题,新增获取文件、列举文件,重构预签名 URL 支持客户端上传、下载、删除等操作,新增 Solon 插件,优化手动分片上传等功能,详情查看 [更新记录](https://x-file-storage.xuyanwu.cn/#/更新记录?id=_220)
<br />
`2.1.0` 修复大量问题,新增存储平台 FastDFS 和 Azure Blob Storage,新增复制、移动(重命名)文件,手动分片上传(断点续传)和计算哈希等功能,详情查看 [更新记录](https://x-file-storage.xuyanwu.cn/#/更新记录?id=_210)
<br />
`2.0.0` 捐赠至 [dromara](https://dromara.org/zh) 开源社区,更改项目名、包名,优化项目结构、支持 Metadata 元数据等,从旧版升级需要注意,详情查看 [更新记录](https://x-file-storage.xuyanwu.cn/#/更新记录?id=_200)
<br />
`1.0.3` 修复了 FileStorageClientFactory 未自动加载等问题,查看 [更新记录](https://x-file-storage.xuyanwu.cn/#/更新记录?id=_103)
<br />
`1.0.2` 修复了华为云 OBS 未加载的问题,查看 [更新记录](https://x-file-storage.xuyanwu.cn/#/更新记录?id=_102)
<br />
`1.0.1` 修复了 MultipartFile 无法正确获取文件名等问题,查看 [更新记录](https://x-file-storage.xuyanwu.cn/#/更新记录?id=_101)
<br />
`1.0.0` 包含了大量功能更新与问题修复,例如解决了内存占用过大问题,支持大文件上传、 [脱离 SpringBoot 单独使用](https://x-file-storage.xuyanwu.cn/#/脱离SpringBoot单独使用) 等,AmazonS3 和 GoogleCloudStorage 存储平台配置名称与之前版本不兼容,查看 [更新记录](https://x-file-storage.xuyanwu.cn/#/更新记录?id=_100)

-------

Expand Down Expand Up @@ -98,7 +92,7 @@ Gitee:https://gitee.com/dromara/x-file-storage
<dependency>
<groupId>org.dromara.x-file-storage</groupId>
<artifactId>x-file-storage-spring</artifactId>
<version>2.2.0</version>
<version>2.2.1</version>
</dependency>
<!-- 引入 阿里云 OSS SDK,如果使用其它存储平台,就引入对应的 SDK -->
<dependency>
Expand Down
10 changes: 2 additions & 8 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,13 @@ Gitee:https://gitee.com/dromara/x-file-storage

这里是简要的更新记录,查看 [详细的更新记录](更新记录)

`2.2.1` 修复某些情况下哈希计算错误的问题、七牛云 Kodo 预签名 URL 无法使用的问题 [更新记录](更新记录?id=_221)
<br />
`2.2.0` 修复大量问题,新增获取文件、列举文件,重构预签名 URL 支持客户端上传、下载、删除等操作,新增 Solon 插件,优化手动分片上传等功能,详情查看 [更新记录](更新记录?id=_220)
<br />
`2.1.0` 修复大量问题,新增存储平台 FastDFS 和 Azure Blob Storage,新增复制、移动(重命名)文件,手动分片上传(断点续传)和计算哈希等功能,详情查看 [更新记录](更新记录?id=_210)
<br />
`2.0.0` 捐赠至 [dromara](https://dromara.org/zh) 开源社区,更改项目名、包名,优化项目结构、支持 Metadata 元数据等,从旧版升级需要注意,详情查看 [更新记录](更新记录?id=_200)
<br />
`1.0.3` 修复了 FileStorageClientFactory 未自动加载等问题,查看 [更新记录](更新记录?id=_103)
<br />
`1.0.2` 修复了华为云 OBS 未加载的问题,查看 [更新记录](更新记录?id=_102)
<br />
`1.0.1` 修复了 MultipartFile 无法正确获取文件名等问题,查看 [更新记录](更新记录?id=_101)
<br />
`1.0.0` 包含了大量功能更新与问题修复,例如解决了内存占用过大问题,支持大文件上传、 [脱离 SpringBoot 单独使用](脱离SpringBoot单独使用) 等,AmazonS3 和 GoogleCloudStorage 存储平台配置名称与之前版本不兼容,查看 [更新记录](更新记录?id=_100)

-------

Expand Down
2 changes: 1 addition & 1 deletion docs/在Solon中使用.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<dependency>
<groupId>org.dromara.x-file-storage</groupId>
<artifactId>x-file-storage-solon</artifactId>
<version>2.2.0</version>
<version>2.2.1</version>
</dependency>
```

Expand Down
7 changes: 4 additions & 3 deletions docs/基础功能.md
Original file line number Diff line number Diff line change
Expand Up @@ -575,9 +575,6 @@ result.getFileList().forEach(info -> log.info("文件:{}", info));
log.info("列举文件完成,共 {} 个文件", result.getFileList().size());
log.info("列举文件全部结果:{}", result);

//列表是否被截断,就是当前目录下还有其它文件或目录超出最大数量未被列举
log.info("列表是否被截断:{}", result.getIsTruncated());
log.info("下次列举的起始位置:{}", result.getNextMarker());

//其它更多参数
ListFilesResult result2 = fileStorageService.listFiles()
Expand All @@ -586,6 +583,10 @@ ListFilesResult result2 = fileStorageService.listFiles()
.setFilenamePrefix("abc") // 文件名前缀
.setMarker("123456") //列举的起始位置,从上一次列举结果中获取
.listFiles();

//列表是否被截断,就是当前目录下还有其它文件或目录超出最大数量未被列举
log.info("列表是否被截断:{}", result2.getIsTruncated());
log.info("下次列举的起始位置:{}", result2.getNextMarker());
```

## 下载
Expand Down
9 changes: 8 additions & 1 deletion docs/快速入门.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<dependency>
<groupId>org.dromara.x-file-storage</groupId>
<artifactId>x-file-storage-spring</artifactId>
<version>2.2.0</version>
<version>2.2.1</version>
</dependency>
```

Expand Down Expand Up @@ -97,6 +97,13 @@
<artifactId>aws-java-sdk-s3</artifactId>
<version>1.12.429</version>
</dependency>

<!-- 如果出现 okhttp 版本问题,可以尝试引入以下版本,没问题则无需引入-->
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.12.0</version>
</dependency>
```

#### **FTP**
Expand Down
7 changes: 7 additions & 0 deletions docs/更新记录.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

-------

## 📦2.2.1 :id=_221
2024-07-18
- 修复某些情况下哈希计算错误的问题
- 修复七牛云 Kodo 预签名 URL 无法使用的问题

-------

## 📦2.2.0 :id=_220
2024-07-02
- 新增获取文件
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>org.dromara.x-file-storage</groupId>
<artifactId>x-file-storage-core</artifactId>
<version>2.2.0</version>
<version>2.2.1</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
</scm>

<properties>
<revision>2.2.0</revision>
<revision>2.2.1</revision>
<!--region Maven Base-->
<maven.version>3.8.1</maven.version>
<java.version>8</java.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public long skip(long n) throws IOException {
public int read() throws IOException {
int b = super.read();
onProgress(b == -1 ? -1 : 1);
if (hashCalculatorManager != null && b > -1) {
if (this.markFlag == 0 && hashCalculatorManager != null && b > -1) {
hashCalculatorManager.update(new byte[] {(byte) b});
}
return b;
Expand All @@ -72,7 +72,7 @@ public int read() throws IOException {
public int read(byte[] b, int off, int len) throws IOException {
onStart();
int bytes = super.read(b, off, len);
if (hashCalculatorManager != null && bytes > 0) {
if (this.markFlag == 0 && hashCalculatorManager != null && bytes > 0) {
hashCalculatorManager.update(Arrays.copyOfRange(b, off, off + bytes));
}
onProgress(bytes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ public class RemoteFileInfo {
* 获取短横命名风格且不区分大小写的文件元数据,以下方式都获得的值相同,put进入的值也会被覆盖<br>
* get("ContentType")<br>
* get("Content_Type")<br>
* get("HelloWorld_test")<br>
* get("Content-Type")<br>
* get("contentType")<br>
*/
Expand All @@ -116,7 +115,6 @@ public MapProxy getKebabCaseInsensitiveMetadata() {
* 获取短横命名风格的文件用户元数据,以下方式都获得的值相同,put进入的值也会被覆盖<br>
* get("ContentType")<br>
* get("Content_Type")<br>
* get("HelloWorld_test")<br>
* get("Content-Type")<br>
* get("contentType")<br>
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
import cn.hutool.core.util.StrUtil;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import lombok.Getter;
import org.dromara.x.file.storage.core.exception.FileStorageRuntimeException;

/**
* 哈希计算器管理器
*/
public class HashCalculatorManager implements HashCalculatorSetter<HashCalculatorManager> {
@Getter
private final List<HashCalculator> hashCalculatorList = new CopyOnWriteArrayList<>();

private volatile HashInfo hashInfo;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ public boolean save(FileInfo fileInfo, UploadPretreatment pre) {
try {
File newFile = FileUtil.touch(getAbsolutePath(newFileKey));
FileWrapper fileWrapper = pre.getFileWrapper();
if (fileWrapper.supportTransfer()) { // 移动文件,速度较快
if (fileWrapper.supportTransfer()
&& pre.getHashCalculatorManager().getHashCalculatorList().isEmpty()) { // 移动文件,速度较快
ProgressListener.quickStart(pre.getProgressListener(), fileWrapper.getSize());
fileWrapper.transferTo(newFile);
ProgressListener.quickFinish(pre.getProgressListener(), fileWrapper.getSize());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ public boolean save(FileInfo fileInfo, UploadPretreatment pre) {
try {
File newFile = FileUtil.touch(getAbsolutePath(newFileKey));
FileWrapper fileWrapper = pre.getFileWrapper();
if (fileWrapper.supportTransfer()) { // 移动文件,速度较快
if (fileWrapper.supportTransfer()
&& pre.getHashCalculatorManager().getHashCalculatorList().isEmpty()) { // 移动文件,速度较快
ProgressListener.quickStart(pre.getProgressListener(), fileWrapper.getSize());
fileWrapper.transferTo(newFile);
ProgressListener.quickFinish(pre.getProgressListener(), fileWrapper.getSize());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ public boolean isSupportPresignedUrl() {
@Override
public GeneratePresignedUrlResult generatePresignedUrl(GeneratePresignedUrlPretreatment pre) {
try {
if (Constant.GeneratePresignedUrl.Method.GET.equalsIgnoreCase(String.valueOf(pre.getMethod()))) {
if (!Constant.GeneratePresignedUrl.Method.GET.equalsIgnoreCase(String.valueOf(pre.getMethod()))) {
throw new FileStorageRuntimeException("七牛云 Kode 仅支持 GET ,如需支持更多功能,可以通过 AWS S3 的 SDK 来使用");
}
String fileKey = getFileKey(new FileInfo(basePath, pre.getPath(), pre.getFilename()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
* 对KEY转换为短横,以下方式都获得的值相同,put进入的值也会被覆盖<br>
* get("ContentType")<br>
* get("Content_Type")<br>
* get("HelloWorld_test")<br>
* get("Content-Type")<br>
* get("contentType")<br>
*
Expand Down
4 changes: 1 addition & 3 deletions x-file-storage-tests/x-file-storage-general-test/pom.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.dromara.x-file-storage</groupId>
Expand Down Expand Up @@ -32,7 +31,6 @@
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-crypto</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
Expand Down
Loading

0 comments on commit acef725

Please sign in to comment.