From 600b6144e4717366029bf824c95a7950f99f0bfb Mon Sep 17 00:00:00 2001 From: jxxghp Date: Sun, 31 Mar 2024 08:17:51 +0800 Subject: [PATCH] =?UTF-8?q?fix=20#1783=20=E7=9B=AE=E5=BD=95=E5=AE=8C?= =?UTF-8?q?=E6=95=B4=E5=BA=A6=E5=8C=B9=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/modules/filetransfer/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/modules/filetransfer/__init__.py b/app/modules/filetransfer/__init__.py index 6a28c511..6612f3bc 100644 --- a/app/modules/filetransfer/__init__.py +++ b/app/modules/filetransfer/__init__.py @@ -726,7 +726,11 @@ class FileTransferModule(_ModuleBase): try: # 计算in_path和path的公共字符串长度 relative = StringUtils.find_common_prefix(str(in_path), str(path)) + if len(str(path)) == len(relative): + # 目录完整匹配的,直接返回 + return path if len(relative) > max_length: + # 更新最大长度 max_length = len(relative) target_path = path except Exception as e: