change code

This commit is contained in:
Looly 2021-11-26 20:38:13 +08:00
parent 449e748f62
commit c85f204da9
2 changed files with 6 additions and 3 deletions

View File

@ -3,7 +3,7 @@
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
# 5.7.17 (2021-11-24) # 5.7.17 (2021-11-26)
### 🐣新特性 ### 🐣新特性
* 【core 】 增加AsyncUtilpr#457@Gitee * 【core 】 增加AsyncUtilpr#457@Gitee
@ -25,6 +25,7 @@
* 【db 】 Db.executeBatch标记一个重载为弃用issue#I4JIPH@Gitee * 【db 】 Db.executeBatch标记一个重载为弃用issue#I4JIPH@Gitee
* 【core 】 增加CharSequenceUtil.subPreGbk重载issue#I4JO2E@Gitee * 【core 】 增加CharSequenceUtil.subPreGbk重载issue#I4JO2E@Gitee
* 【core 】 ReflectUtil.getMethod排除桥接方法pr#1965@Github * 【core 】 ReflectUtil.getMethod排除桥接方法pr#1965@Github
* 【http 】 completeFileNameFromHeader在使用path为路径时自动解码issue#I4K0FS@Gitee
* *
### 🐞Bug修复 ### 🐞Bug修复
* 【core 】 修复FileResource构造fileName参数无效问题issue#1942@Github * 【core 】 修复FileResource构造fileName参数无效问题issue#1942@Github

View File

@ -7,7 +7,6 @@ import cn.hutool.core.io.IORuntimeException;
import cn.hutool.core.io.IoUtil; import cn.hutool.core.io.IoUtil;
import cn.hutool.core.io.StreamProgress; import cn.hutool.core.io.StreamProgress;
import cn.hutool.core.lang.Assert; import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.CharsetUtil;
import cn.hutool.core.util.ReUtil; import cn.hutool.core.util.ReUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.core.util.URLUtil; import cn.hutool.core.util.URLUtil;
@ -434,7 +433,10 @@ public class HttpResponse extends HttpBase<HttpResponse> implements Closeable {
fileName = StrUtil.subSuf(path, path.lastIndexOf('/') + 1); fileName = StrUtil.subSuf(path, path.lastIndexOf('/') + 1);
if (StrUtil.isBlank(fileName)) { if (StrUtil.isBlank(fileName)) {
// 编码后的路径做为文件名 // 编码后的路径做为文件名
fileName = URLUtil.encodeQuery(path, CharsetUtil.CHARSET_UTF_8); fileName = URLUtil.encodeQuery(path, charset);
} else {
// issue#I4K0FS@Gitee
fileName = URLUtil.decode(fileName, charset);
} }
} }
return FileUtil.file(targetFileOrDir, fileName); return FileUtil.file(targetFileOrDir, fileName);