mirror of
https://gitee.com/dromara/hutool.git
synced 2025-04-05 17:37:59 +08:00
ServletUtil遵循rfc 3986优化
This commit is contained in:
parent
b212fdc685
commit
21eecdc760
@ -3,13 +3,14 @@
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
# 5.8.12.M1 (2023-01-15)
|
||||
# 5.8.12.M1 (2023-01-16)
|
||||
|
||||
### 🐣新特性
|
||||
* 【core 】 XmlUtil.readObjectFromXml增加注入漏洞的警告注释,并标识为废弃(issue#2857@Github)
|
||||
* 【http 】 HttpGlobalConfig.allowPatch()调用时忽略错误(issue#2832@Github)
|
||||
* 【core 】 重构根据file magic number判断文件类型(pr#2834@Github)
|
||||
* 【core 】 增加WGS84 坐标与墨卡托投影互转(pr#2811@Github)
|
||||
* 【extra 】 ServletUtil遵循rfc 3986优化(issue#I6ALAO@Gitee)
|
||||
|
||||
### 🐞Bug修复
|
||||
* 【core 】 修复HexUtil.isHexNumber()对"-"的判断问题(issue#2857@Github)
|
||||
|
@ -614,8 +614,9 @@ public class JakartaServletUtil {
|
||||
*/
|
||||
public static void write(HttpServletResponse response, InputStream in, String contentType, String fileName) {
|
||||
final String charset = ObjectUtil.defaultIfNull(response.getCharacterEncoding(), CharsetUtil.UTF_8);
|
||||
response.setHeader("Content-Disposition", StrUtil.format("attachment;filename=\"{}\"",
|
||||
URLUtil.encode(fileName, CharsetUtil.charset(charset))));
|
||||
final String encodeText = URLUtil.encodeAll(fileName, CharsetUtil.charset(charset));
|
||||
response.setHeader("Content-Disposition",
|
||||
StrUtil.format("attachment;filename=\"{}\";filename*={}''{}", encodeText, charset, encodeText));
|
||||
response.setContentType(contentType);
|
||||
write(response, in);
|
||||
}
|
||||
|
@ -613,8 +613,9 @@ public class ServletUtil {
|
||||
*/
|
||||
public static void write(HttpServletResponse response, InputStream in, String contentType, String fileName) {
|
||||
final String charset = ObjectUtil.defaultIfNull(response.getCharacterEncoding(), CharsetUtil.UTF_8);
|
||||
response.setHeader("Content-Disposition", StrUtil.format("attachment;filename=\"{}\"",
|
||||
URLUtil.encode(fileName, CharsetUtil.charset(charset))));
|
||||
final String encodeText = URLUtil.encodeAll(fileName, CharsetUtil.charset(charset));
|
||||
response.setHeader("Content-Disposition",
|
||||
StrUtil.format("attachment;filename=\"{}\";filename*={}''{}", encodeText, charset, encodeText));
|
||||
response.setContentType(contentType);
|
||||
write(response, in);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user