修复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

@@ -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);