From 6c672d538700f51a9a4a9f9c16dad96656500377 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Tue, 15 Aug 2023 06:57:48 +0800 Subject: [PATCH] fix #121 --- app/modules/filetransfer/__init__.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/modules/filetransfer/__init__.py b/app/modules/filetransfer/__init__.py index 1e30da77..58cdb633 100644 --- a/app/modules/filetransfer/__init__.py +++ b/app/modules/filetransfer/__init__.py @@ -588,10 +588,14 @@ class FileTransferModule(_ModuleBase): target_path = None if in_path: for path in dest_paths: - relative = Path(path).relative_to(in_path).as_posix() - if relative.startswith("..") or len(relative) > max_length: - max_length = len(relative) - target_path = path + try: + relative = Path(path).relative_to(in_path).as_posix() + if relative.startswith("..") or 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) # 顺序匹配第1个满足空间存储要求的目录