mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-04-19 03:01:48 +08:00
fix bug
This commit is contained in:
parent
60a8fd48f5
commit
490e512975
@ -3,7 +3,7 @@
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
# 5.7.17 (2021-11-19)
|
||||
# 5.7.17 (2021-11-20)
|
||||
|
||||
### 🐣新特性
|
||||
* 【core 】 增加AsyncUtil(pr#457@Gitee)
|
||||
@ -24,6 +24,7 @@
|
||||
### 🐞Bug修复
|
||||
* 【core 】 修复FileResource构造fileName参数无效问题(issue#1942@Github)
|
||||
* 【cache 】 修复WeakCache键值强关联导致的无法回收问题(issue#1953@Github)
|
||||
* 【core 】 修复ZipUtil相对路径父路径获取null问题(issue#1961@Github)
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
@ -1002,8 +1002,17 @@ public class ZipUtil {
|
||||
throw new UtilException(StrUtil.format("File [{}] not exist!", srcFile.getAbsolutePath()));
|
||||
}
|
||||
|
||||
// issue#1961@Github
|
||||
// 当 zipFile = new File("temp.zip") 时, zipFile.getParentFile() == null
|
||||
File parentFile;
|
||||
try {
|
||||
parentFile = zipFile.getCanonicalFile().getParentFile();
|
||||
} catch (IOException e) {
|
||||
parentFile = zipFile.getParentFile();
|
||||
}
|
||||
|
||||
// 压缩文件不能位于被压缩的目录内
|
||||
if (srcFile.isDirectory() && FileUtil.isSub(srcFile, zipFile.getParentFile())) {
|
||||
if (srcFile.isDirectory() && FileUtil.isSub(srcFile, parentFile)) {
|
||||
throw new UtilException("Zip file path [{}] must not be the child directory of [{}] !", zipFile.getPath(), srcFile.getPath());
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user