mirror of
https://gitee.com/dromara/hutool.git
synced 2025-04-05 17:37:59 +08:00
change extName
This commit is contained in:
parent
ccc9f2568f
commit
ae8849c665
15
CHANGELOG.md
15
CHANGELOG.md
@ -2,20 +2,21 @@
|
||||
# 🚀Changelog
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
# 5.7.23 (2022-03-03)
|
||||
# 5.7.23 (2022-03-04)
|
||||
|
||||
### 🐣新特性
|
||||
* 【http 】 HttpRequest.form采用TableMap方式(issue#I4W427@gitee)
|
||||
* 【core 】 AnnotationUtil增加getAnnotationAlias方法(pr#554@gitee)
|
||||
* 【http 】 HttpRequest.form采用TableMap方式(issue#I4W427@Gitee)
|
||||
* 【core 】 AnnotationUtil增加getAnnotationAlias方法(pr#554@Gitee)
|
||||
* 【core 】 FileUtil.extName增加对tar.gz特殊处理(issue#I4W5FS@Gitee)
|
||||
### 🐞Bug修复
|
||||
* 【core 】 修复ObjectUtil.hasNull传入null返回true的问题(pr#555@gitee)
|
||||
* 【core 】 修复ObjectUtil.hasNull传入null返回true的问题(pr#555@Gitee)
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
# 5.7.22 (2022-03-01)
|
||||
|
||||
### 🐣新特性
|
||||
* 【poi 】 ExcelUtil.readBySax增加对POI-5.2.0的兼容性(issue#I4TJF4@gitee)
|
||||
* 【extra 】 Ftp增加构造(issue#I4TKXP@gitee)
|
||||
* 【poi 】 ExcelUtil.readBySax增加对POI-5.2.0的兼容性(issue#I4TJF4@Gitee)
|
||||
* 【extra 】 Ftp增加构造(issue#I4TKXP@Gitee)
|
||||
* 【core 】 GenericBuilder支持Map构建(pr#540@Github)
|
||||
* 【json 】 新增TemporalAccessorSerializer
|
||||
* 【core 】 使多个xxxBuilder实现Builder接口,扩展CheckedUtil(pr#545@Gitee)
|
||||
@ -547,7 +548,7 @@
|
||||
* 【json 】 增加JSONWriter
|
||||
* 【core 】 IdUtil增加getWorkerId和getDataCenterId(issueI3Y5NI@Gitee)
|
||||
* 【core 】 JWTValidator增加leeway重载
|
||||
* 【core 】 增加RegexPool(issue#I3W9ZF@gitee)
|
||||
* 【core 】 增加RegexPool(issue#I3W9ZF@Gitee)
|
||||
|
||||
### 🐞Bug修复
|
||||
* 【json 】 修复XML转义字符的问题(issue#I3XH09@Gitee)
|
||||
|
@ -222,6 +222,11 @@ public class FileNameUtil {
|
||||
if (index == -1) {
|
||||
return StrUtil.EMPTY;
|
||||
} else {
|
||||
// issue#I4W5FS@Gitee
|
||||
if(fileName.endsWith("tar.gz")){
|
||||
return "tar.gz";
|
||||
}
|
||||
|
||||
String ext = fileName.substring(index + 1);
|
||||
// 扩展名中不能包含路径相关的符号
|
||||
return StrUtil.containsAny(ext, UNIX_SEPARATOR, WINDOWS_SEPARATOR) ? StrUtil.EMPTY : ext;
|
||||
|
@ -392,6 +392,10 @@ public class FileUtilTest {
|
||||
path = FileUtil.isWindows() ? "d:\\aaa\\bbb\\cc\\fff.xlsx" : "~/Desktop/hutool/fff.xlsx";
|
||||
mainName = FileUtil.extName(path);
|
||||
Assert.assertEquals("xlsx", mainName);
|
||||
|
||||
path = FileUtil.isWindows() ? "d:\\aaa\\bbb\\cc\\fff.tar.gz" : "~/Desktop/hutool/fff.tar.gz";
|
||||
mainName = FileUtil.extName(path);
|
||||
Assert.assertEquals("tar.gz", mainName);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
Reference in New Issue
Block a user