Skip to content

Commit

Permalink
fix #662
Browse files Browse the repository at this point in the history
  • Loading branch information
jxxghp committed Sep 24, 2023
1 parent a7b51d9 commit b3c0dc8
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions app/modules/filetransfer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,24 +536,22 @@ 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):
return libpath
except Exception as e:
logger.debug(f"计算媒体库路径时出错:{e}")
continue
return None
return path

@staticmethod
def get_target_path(in_path: Path = None) -> Optional[Path]:
Expand Down

0 comments on commit b3c0dc8

Please sign in to comment.