From d4c15124d5d5fa0a730436bb9ddac2251863e61a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B9=E7=A3=8A?= <45566618@qq.com> Date: Fri, 31 May 2024 09:52:37 +0800 Subject: [PATCH] =?UTF-8?q?SFTP=E4=B8=8A=E4=BC=A0,?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/org/jeecg/common/util/SFTPUtil.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/SFTPUtil.java b/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/SFTPUtil.java index c643e7ab..484857e1 100644 --- a/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/SFTPUtil.java +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/SFTPUtil.java @@ -286,7 +286,11 @@ public class SFTPUtil { } String newName = CommonUtils.getFileName(df[1]); - String newDownloadFile = saveFile.concat(File.separator).concat(newName); + newName = newName.replace("\\","/"); + if(!newName.startsWith("/")){ + newName = "/"+newName; + } + String newDownloadFile = saveFile.concat(newName); File localFile = new File(newDownloadFile); // 判断本地目录是否存在,不存在需要新建各级目录