Looly 6 年之前
父节点
当前提交
367d0d40b8
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java

+ 1 - 1
hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java

@@ -1548,7 +1548,7 @@ public class FileUtil {
 		// 去除file:前缀
 		// 去除file:前缀
 		pathToUse = StrUtil.removePrefixIgnoreCase(pathToUse, URLUtil.FILE_URL_PREFIX);
 		pathToUse = StrUtil.removePrefixIgnoreCase(pathToUse, URLUtil.FILE_URL_PREFIX);
 		// 统一使用斜杠
 		// 统一使用斜杠
-		pathToUse = pathToUse.replaceAll("[/\\\\]{2,}", StrUtil.SLASH).trim();
+		pathToUse = pathToUse.replaceAll("[/\\\\]+", StrUtil.SLASH).trim();
 		//兼容Windows下的共享目录路径(原始路径如果以\\开头,则保留这种路径)
 		//兼容Windows下的共享目录路径(原始路径如果以\\开头,则保留这种路径)
 		if(path.startsWith("\\\\")){
 		if(path.startsWith("\\\\")){
 			pathToUse = "\\" + pathToUse;
 			pathToUse = "\\" + pathToUse;