-
Notifications
You must be signed in to change notification settings - Fork 273
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #125 from dromara/dev
Release 2.0.0
- Loading branch information
Showing
142 changed files
with
3,176 additions
and
915 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
spring-file-storage.xuyanwu.cn | ||
x-file-storage.xuyanwu.cn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Metadata 元数据 | ||
|
||
## 使用 | ||
|
||
可以在上传时传入 Metadata 和 UserMetadata ,目前仅 华为云 OBS、阿里云 OSS、腾讯云 COS、百度云 BOS、七牛云 Kodo、又拍云 USS、MinIO、Amazon S3、GoogleCloud Storage 平台支持 | ||
|
||
```java | ||
//判断是否支持 Metadata | ||
FileStorage storage = fileStorageService.getFileStorage(); | ||
boolean supportMetadata = fileStorageService.isSupportMetadata(storage); | ||
|
||
//上传并传入 Metadata | ||
FileInfo fileInfo = fileStorageService.of(file) | ||
.putMetadata(Constant.Metadata.CONTENT_DISPOSITION,"attachment;filename=DownloadFileName.jpg") | ||
.putMetadata("Test-Not-Support","123456")//测试不支持的元数据,此数据并不会生效 | ||
.putUserMetadata("role","666") | ||
.putThMetadata(Constant.Metadata.CONTENT_DISPOSITION,"attachment;filename=DownloadThFileName.jpg") | ||
.putThUserMetadata("role","777") | ||
.thumbnail() | ||
.upload(); | ||
``` | ||
|
||
> [!WARNING|label:重要提示:] | ||
> 每个存储平台支持的 Metadata 有所不同,例如 七牛云 Kodo 和 又拍云 USS 就不支持 `Content-Disposition`,具体支持情况以每个存储平台的官方文档为准 | ||
> | ||
> 在传入 UserMetadata 时,不用传入前缀,例如 `x-amz-meta-` `x-qn-meta-` `x-upyun-meta-`,SDK会自动处理 | ||
|
||
## 处理异常 | ||
|
||
默认在不支持的存储平台传入 UserMetadata 会抛出异常,可以通过以下方式不抛出异常 | ||
|
||
**第一种(全局)** | ||
```yaml | ||
dromara: | ||
x-file-storage: | ||
upload-not-support-metadata-throw-exception: false | ||
``` | ||
**第二种(仅当前)** | ||
```java | ||
FileInfo fileInfo = fileStorageService.of(file) | ||
.setNotSupportMetadataThrowException(false) //在不支持 Metadata 的存储平台不抛出异常 | ||
.putUserMetadata("role","666") | ||
.upload(); | ||
``` | ||
|
||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[我的博客(常年不更新)](https://xuyanwu.cn) | ||
| ||
[用 JavaScript 在浏览器中控制台观看 BadApple!!](https://app.xuyanwu.cn/BadApple/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
* 文档版本 1.0.3 | ||
* 🌟文档版本 2.0.0 | ||
|
||
* [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/) | ||
* [0.7.0](https://spring-file-storage.xuyanwu.cn/0.7.0/) | ||
* [0.6.1](https://spring-file-storage.xuyanwu.cn/0.6.1/) | ||
* [0.6.0](https://spring-file-storage.xuyanwu.cn/0.6.0/) | ||
* [0.5.0](https://spring-file-storage.xuyanwu.cn/0.5.0/) | ||
* [0.4.0](https://spring-file-storage.xuyanwu.cn/0.4.0/) | ||
* [2.0.0](https://x-file-storage.xuyanwu.cn/2.0.0/) | ||
* [1.0.3](https://x-file-storage.xuyanwu.cn/1.0.3/) | ||
* [1.0.2](https://x-file-storage.xuyanwu.cn/1.0.2/) | ||
* [1.0.1](https://x-file-storage.xuyanwu.cn/1.0.1/) | ||
* [1.0.0](https://x-file-storage.xuyanwu.cn/1.0.0/) | ||
* [0.7.0](https://x-file-storage.xuyanwu.cn/0.7.0/) | ||
* [0.6.1](https://x-file-storage.xuyanwu.cn/0.6.1/) | ||
* [0.6.0](https://x-file-storage.xuyanwu.cn/0.6.0/) | ||
* [0.5.0](https://x-file-storage.xuyanwu.cn/0.5.0/) | ||
* [0.4.0](https://x-file-storage.xuyanwu.cn/0.4.0/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
* [简介](/ "简介") | ||
* [快速入门](快速入门 "快速入门") | ||
* [基础功能](基础功能 "基础功能") | ||
* [ACL 访问控制列表](acl "ACL 访问控制列表") | ||
* [预签名 URL](预签名URL "签名 URL") | ||
* [存储平台](存储平台 "存储平台") | ||
* [文件适配器](文件适配器 "文件适配器") | ||
* [识别文件的 MIME 类型](识别文件的MIME类型 "识别文件的 MIME 类型") | ||
* [切面](切面 "切面") | ||
* [脱离 SpringBoot 单独使用](脱离SpringBoot单独使用 "脱离 SpringBoot 单独使用") | ||
* [常见问题](常见问题 "常见问题") | ||
* [更新记录](更新记录 "更新记录") | ||
* [📚简介](/ "简介") | ||
* [🍭快速入门](快速入门 "快速入门") | ||
* [🍬基础功能](基础功能 "基础功能") | ||
* [🍉ACL 访问控制列表](acl "ACL 访问控制列表") | ||
* [🥑预签名 URL](预签名URL "签名 URL") | ||
* [🌼Metadata 元数据](Metadata "Metadata 元数据") | ||
* [🥦存储平台](存储平台 "存储平台") | ||
* [🌽文件适配器](文件适配器 "文件适配器") | ||
* [🔍️识别文件的 MIME 类型](识别文件的MIME类型 "识别文件的 MIME 类型") | ||
* [🧪切面](切面 "切面") | ||
* [🌱脱离 SpringBoot 单独使用](脱离SpringBoot单独使用 "脱离 SpringBoot 单独使用") | ||
* [🙋♂️常见问题](常见问题 "常见问题") | ||
* [📜更新记录](更新记录 "更新记录") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.