diff --git a/app/modules/filemanager/__init__.py b/app/modules/filemanager/__init__.py index dbb769845..fa0c76694 100644 --- a/app/modules/filemanager/__init__.py +++ b/app/modules/filemanager/__init__.py @@ -447,7 +447,7 @@ def __get_targetitem(_path: Path) -> FileItem: logger.warn(f"文件已存在:{target_file}") return __get_targetitem(target_file), "" # 网盘到本地 - if transfer_type == "copy": + if transfer_type in ["copy", "move"]: # 下载 tmp_file = source_oper.download(fileitem) if tmp_file: @@ -455,20 +455,10 @@ def __get_targetitem(_path: Path) -> FileItem: if not target_file.parent.exists(): target_file.parent.mkdir(parents=True) # 将tmp_file移动后target_file - tmp_file.rename(target_file) - return __get_targetitem(target_file), "" - else: - return None, f"{fileitem.path} {fileitem.storage} 下载失败" - elif transfer_type == "move": - # 下载 - tmp_file = source_oper.download(fileitem) - if tmp_file: - if not target_file.parent.exists(): - target_file.parent.mkdir(parents=True) - # 将tmp_file移动后target_file - tmp_file.rename(target_file) - # 删除源文件 - source_oper.delete(fileitem) + SystemUtils.move(tmp_file, target_file) + if transfer_type == "move": + # 删除源文件 + source_oper.delete(fileitem) return __get_targetitem(target_file), "" else: return None, f"{fileitem.path} {fileitem.storage} 下载失败"