修复Sftp中exists方法父目录不存在时报错

This commit is contained in:
Looly 2023-06-12 16:13:36 +08:00
parent 738a0f6db8
commit 469c6aa09a
2 changed files with 7 additions and 1 deletions

View File

@ -2,7 +2,7 @@
# 🚀Changelog
-------------------------------------------------------------------------------------------------------------
# 5.8.20(2023-06-09)
# 5.8.20(2023-06-12)
### 🐣新特性
* 【core 】 UrlQuery增加setStrict方法区分是否严格模式issue#I78PB1@Gitee
@ -16,6 +16,7 @@
* 【core 】 修复IdcardUtil.getGenderByIdCard存在潜在的异常pr#1007@Gitee
* 【core 】 修复Table#contains空指针问题issue#3135@Gitee
* 【core 】 修复FileUtil.checkSlip方法缺陷issue#3140@Github
* 【extra 】 修复Sftp中exists方法父目录不存在时报错issue#I7CSQ9@Gitee
-------------------------------------------------------------------------------------------------------------
# 5.8.19(2023-05-27)

View File

@ -113,6 +113,11 @@ public abstract class AbstractFtp implements Closeable {
}
// 文件验证
final String dir = StrUtil.emptyToDefault(StrUtil.removeSuffix(path, fileName), ".");
// issue#I7CSQ9 检查父目录为目录且是否存在
if(false == isDir(dir)){
return false;
}
final List<String> names;
try {
names = ls(dir);