From ac3fc026e126abac7c328149403a17736ebc3b41 Mon Sep 17 00:00:00 2001 From: Looly Date: Wed, 14 Sep 2022 21:43:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DFtp=E4=B8=AD=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + hutool-extra/src/main/java/cn/hutool/extra/ftp/Ftp.java | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0583d2bd6..f9d6cd7d5 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ * 【core 】 修复ObjectUtil.defaultIfXXX中NPE问题(pr#2603@Github) * 【db 】 修复Hive2驱动无法识别问题(issue#2606@Github) * 【core 】 修复computeIfAbsent问题(issue#I5PTN3@Gitee) +* 【extra 】 修复Ftp中路径问题(issue#I5R2DE@Gitee) ------------------------------------------------------------------------------------------------------------- diff --git a/hutool-extra/src/main/java/cn/hutool/extra/ftp/Ftp.java b/hutool-extra/src/main/java/cn/hutool/extra/ftp/Ftp.java index 05182e6b5..0045b451a 100755 --- a/hutool-extra/src/main/java/cn/hutool/extra/ftp/Ftp.java +++ b/hutool-extra/src/main/java/cn/hutool/extra/ftp/Ftp.java @@ -375,7 +375,7 @@ public class Ftp extends AbstractFtp { String pwd = null; if (StrUtil.isNotBlank(path)) { pwd = pwd(); - if (false == isDir(path)) { + if (false == cd(path)) { throw new FtpException("Change dir to [{}] error, maybe path not exist!", path); } } @@ -439,7 +439,7 @@ public class Ftp extends AbstractFtp { final String pwd = pwd(); final String fileName = FileUtil.getName(path); final String dir = StrUtil.removeSuffix(path, fileName); - if (false == isDir(dir)) { + if (false == cd(dir)) { throw new FtpException("Change dir to [{}] error, maybe dir not exist!", path); } @@ -557,7 +557,7 @@ public class Ftp extends AbstractFtp { if (StrUtil.isNotBlank(destPath)) { mkDirs(destPath); - if (false == isDir(destPath)) { + if (false == cd(destPath)) { throw new FtpException("Change dir to [{}] error, maybe dir not exist!", destPath); } } @@ -665,7 +665,7 @@ public class Ftp extends AbstractFtp { pwd = pwd(); } - if (false == isDir(path)) { + if (false == cd(path)) { throw new FtpException("Change dir to [{}] error, maybe dir not exist!", path); }