From b3c0dc813b2d7dcc650e14dbdf5938e7d8b01327 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Mon, 25 Sep 2023 07:12:36 +0800 Subject: [PATCH] fix #662 --- app/modules/filetransfer/__init__.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/app/modules/filetransfer/__init__.py b/app/modules/filetransfer/__init__.py index 390e5f42b..64d34ad9b 100644 --- a/app/modules/filetransfer/__init__.py +++ b/app/modules/filetransfer/__init__.py @@ -536,16 +536,14 @@ def get_rename_path(template_string: str, rename_dict: dict, path: Path = None) @staticmethod def get_library_path(path: Path): """ - 根据目录查询其所在的媒体库目录 + 根据目录查询其所在的媒体库目录,查询不到的返回输入目录 """ if not path: return None if not settings.LIBRARY_PATHS: - return None + return path # 目的路径,多路径以,分隔 dest_paths = settings.LIBRARY_PATHS - if len(dest_paths) == 1: - return dest_paths[0] for libpath in dest_paths: try: if path.is_relative_to(libpath): @@ -553,7 +551,7 @@ def get_library_path(path: Path): except Exception as e: logger.debug(f"计算媒体库路径时出错:{e}") continue - return None + return path @staticmethod def get_target_path(in_path: Path = None) -> Optional[Path]: