From e211032cdd5dbbb07b680cbcad493c64ae5b97d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E8=B6=85?= Date: Tue, 12 May 2020 23:36:34 +0800 Subject: [PATCH] =?UTF-8?q?QW-182=20=E6=96=87=E4=BB=B6=E5=A4=B9=E5=90=8D?= =?UTF-8?q?=E7=A7=B0=E5=B8=A6=E5=8D=95=E5=BC=95=E5=8F=B7=E7=AD=89=E5=85=B6?= =?UTF-8?q?=E4=BB=96=E7=AC=A6=E5=8F=B7=E6=97=B6=EF=BC=8C=E6=89=B9=E9=87=8F?= =?UTF-8?q?-=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=E5=A4=B9=E6=8A=A5?= =?UTF-8?q?=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/mac/scp/service/FileService.java | 10 ++++++++++ .../src/main/resources/mybatis/mapper/FileMapper.xml | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/file-web/src/main/java/com/mac/scp/service/FileService.java b/file-web/src/main/java/com/mac/scp/service/FileService.java index d17f726..b780630 100644 --- a/file-web/src/main/java/com/mac/scp/service/FileService.java +++ b/file-web/src/main/java/com/mac/scp/service/FileService.java @@ -74,6 +74,11 @@ public class FileService implements IFileService { @Override public List selectFileTreeListLikeFilePath(String filePath) { FileBean fileBean = new FileBean(); + filePath = filePath.replace("\\", "\\\\\\\\"); + filePath = filePath.replace("'", "\\'"); + filePath = filePath.replace("%", "\\%"); + filePath = filePath.replace("_", "\\_"); + fileBean.setFilepath(filePath); return fileMapper.selectFileTreeListLikeFilePath(fileBean); @@ -142,6 +147,11 @@ public class FileService implements IFileService { oldfilepath = oldfilepath + filename + "/"; newfilepath = newfilepath + filename + "/"; + oldfilepath = oldfilepath.replace("\\", "\\\\\\\\"); + oldfilepath = oldfilepath.replace("'", "\\'"); + oldfilepath = oldfilepath.replace("%", "\\%"); + oldfilepath = oldfilepath.replace("_", "\\_"); + if (extendname == null) { //为null说明是目录,则需要移动子目录 fileMapper.updateFilepathByFilepath(oldfilepath, newfilepath); } diff --git a/file-web/src/main/resources/mybatis/mapper/FileMapper.xml b/file-web/src/main/resources/mybatis/mapper/FileMapper.xml index 3516991..52abea3 100644 --- a/file-web/src/main/resources/mybatis/mapper/FileMapper.xml +++ b/file-web/src/main/resources/mybatis/mapper/FileMapper.xml @@ -93,7 +93,7 @@