修复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
+2 -1
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)
@@ -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);