From 7da2a69dd0863d1edeb6d58b3b8f550a74283685 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Fri, 18 Aug 2023 17:07:08 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E5=A4=9A=E7=9B=AE=E5=BD=95=E6=8B=A9?= =?UTF-8?q?=E4=BC=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/modules/filetransfer/__init__.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/modules/filetransfer/__init__.py b/app/modules/filetransfer/__init__.py index 3e25af02..98cc2178 100644 --- a/app/modules/filetransfer/__init__.py +++ b/app/modules/filetransfer/__init__.py @@ -572,12 +572,11 @@ class FileTransferModule(_ModuleBase): if in_path: for path in dest_paths: try: - relative = Path(path).relative_to(in_path).as_posix() - if relative.startswith("..") or len(relative) > max_length: + relative = Path(in_path).relative_to(path).as_posix() + if len(relative) > max_length: max_length = len(relative) target_path = path except Exception as e: - logger.debug(f"计算目标路径时出错:{e}") continue if target_path: return Path(target_path)