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