Skip to content

Commit

Permalink
Merge pull request #36 from 1171736840/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
1171736840 authored Sep 5, 2022
2 parents 3b7518d + 32b7918 commit 2ea3f44
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 7 deletions.
3 changes: 2 additions & 1 deletion docs/_navbar.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
* 文档版本 0.6.0
* 文档版本 0.6.1

* [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/)
4 changes: 4 additions & 0 deletions docs/更新记录.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# 更新记录

## 0.6.1
2022-09-05
- 优化 ContentType 的识别方式

## 0.6.0
2022-08-17
- 增加对 FTP 的支持
Expand Down
2 changes: 1 addition & 1 deletion 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>0.6.0</version>
<version>0.6.1</version>

<name>spring-file-storage-parent</name>
<description>A File Storage Service</description>
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>0.6.0</version>
<version>0.6.1</version>
<name>spring-file-storage-test</name>
<description>spring-file-storage 的测试和演示模块</description>

Expand Down Expand Up @@ -116,7 +116,7 @@
<dependency>
<groupId>cn.xuyanwu</groupId>
<artifactId>spring-file-storage</artifactId>
<version>0.6.0</version>
<version>0.6.1</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>0.6.0</version>
<version>0.6.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ public FileInfo upload(UploadPretreatment pre) {
} else if (pre.getFileWrapper().getContentType() != null) {
fileInfo.setContentType(pre.getFileWrapper().getContentType());
} else {
fileInfo.setContentType(URLConnection.guessContentTypeFromName(fileInfo.getFilename()));
String contentType = URLConnection.guessContentTypeFromName(fileInfo.getFilename());
fileInfo.setContentType(contentType != null ? contentType : "application/octet-stream");
}

byte[] thumbnailBytes = pre.getThumbnailBytes();
Expand All @@ -112,7 +113,8 @@ public FileInfo upload(UploadPretreatment pre) {
} else {
fileInfo.setThFilename(fileInfo.getFilename() + pre.getThumbnailSuffix());
}
fileInfo.setThContentType(URLConnection.guessContentTypeFromName(fileInfo.getThFilename()));
String contentType = URLConnection.guessContentTypeFromName(fileInfo.getThFilename());
fileInfo.setThContentType(contentType != null ? contentType : "application/octet-stream");
}

FileStorage fileStorage = getFileStorage(pre.getPlatform());
Expand Down

0 comments on commit 2ea3f44

Please sign in to comment.