From f636681dd8c33d9f5ee4f313dc58cbdeca42f283 Mon Sep 17 00:00:00 2001 From: zhaojun <873019219@qq.com> Date: Wed, 2 Feb 2022 20:45:05 +0800 Subject: [PATCH] =?UTF-8?q?fix(bug):=20=E4=BF=AE=E5=A4=8D=E6=9C=AC?= =?UTF-8?q?=E5=9C=B0=E5=AD=98=E5=82=A8=E5=8F=AF=E9=80=9A=E8=BF=87=E7=89=B9?= =?UTF-8?q?=E6=AE=8A=E5=91=BD=E4=BB=A4=E8=AE=BF=E9=97=AE=E5=88=B0=E9=9D=9E?= =?UTF-8?q?=E6=8C=87=E5=AE=9A=E7=9B=AE=E5=BD=95=E7=9A=84=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/im/zhaojun/zfile/service/impl/LocalServiceImpl.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/im/zhaojun/zfile/service/impl/LocalServiceImpl.java b/src/main/java/im/zhaojun/zfile/service/impl/LocalServiceImpl.java index 34ad9a5..a27c8a0 100644 --- a/src/main/java/im/zhaojun/zfile/service/impl/LocalServiceImpl.java +++ b/src/main/java/im/zhaojun/zfile/service/impl/LocalServiceImpl.java @@ -1,5 +1,6 @@ package im.zhaojun.zfile.service.impl; +import cn.hutool.core.util.StrUtil; import im.zhaojun.zfile.exception.InitializeDriveException; import im.zhaojun.zfile.exception.NotExistFileException; import im.zhaojun.zfile.model.constant.StorageConfigConstant; @@ -25,6 +26,7 @@ import javax.annotation.Resource; import java.io.File; import java.io.FileNotFoundException; import java.util.ArrayList; +import java.util.Collections; import java.util.Date; import java.util.List; import java.util.Map; @@ -72,6 +74,9 @@ public class LocalServiceImpl extends AbstractBaseFileService implements BaseFil @Override public List fileList(String path) throws FileNotFoundException { + if (StrUtil.startWith(path, "..")) { + return Collections.emptyList(); + } List fileItemList = new ArrayList<>(); String fullPath = StringUtils.removeDuplicateSeparator(filePath + path);