From 3b73dfcdc602ef74ecd4afd2fad33fc3c18b94d0 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Fri, 8 Sep 2023 22:36:31 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E6=96=87=E4=BB=B6=E8=BD=AC=E7=A7=BB?= =?UTF-8?q?=E6=97=B6=E6=97=A0=E6=B3=95=E8=A6=86=E7=9B=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/modules/filetransfer/__init__.py | 15 ++++++++------- app/plugins/brushflow/__init__.py | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/app/modules/filetransfer/__init__.py b/app/modules/filetransfer/__init__.py index 2bc80167..a217b49d 100644 --- a/app/modules/filetransfer/__init__.py +++ b/app/modules/filetransfer/__init__.py @@ -283,7 +283,7 @@ class FileTransferModule(_ModuleBase): return retcode def __transfer_file(self, file_item: Path, new_file: Path, transfer_type: str, - over_flag: bool = False, old_file: Path = None) -> int: + over_flag: bool = False) -> int: """ 转移一个文件,同时处理其他相关文件 :param file_item: 原文件路径 @@ -291,12 +291,13 @@ class FileTransferModule(_ModuleBase): :param transfer_type: RmtMode转移方式 :param over_flag: 是否覆盖,为True时会先删除再转移 """ - if not over_flag and new_file.exists(): - logger.warn(f"文件已存在:{new_file}") - return 0 - if over_flag and old_file and old_file.exists(): - logger.info(f"正在删除已存在的文件:{old_file}") - old_file.unlink() + if new_file.exists(): + if not over_flag: + logger.warn(f"文件已存在:{new_file}") + return 0 + else: + logger.info(f"正在删除已存在的文件:{new_file}") + new_file.unlink() logger.info(f"正在转移文件:{file_item} 到 {new_file}") # 创建父目录 new_file.parent.mkdir(parents=True, exist_ok=True) diff --git a/app/plugins/brushflow/__init__.py b/app/plugins/brushflow/__init__.py index 1efbc8d8..31882b8d 100644 --- a/app/plugins/brushflow/__init__.py +++ b/app/plugins/brushflow/__init__.py @@ -798,7 +798,7 @@ class BrushFlow(_PluginBase): }, { 'component': 'td', - 'text': data.get('ratio') + 'text': round(data.get('ratio') or 0, 2) }, { 'component': 'td',