diff --git a/app/modules/filemanager/storages/smb.py b/app/modules/filemanager/storages/smb.py index 40893819..983a7df3 100644 --- a/app/modules/filemanager/storages/smb.py +++ b/app/modules/filemanager/storages/smb.py @@ -382,6 +382,11 @@ class SMB(StorageBase, metaclass=WeakSingleton): smb_path = self._normalize_path(fileitem.path.rstrip("/")) logger.info(f"【SMB】开始删除: {fileitem.path} (类型: {fileitem.type})") + # 先检查路径是否存在 + if not smbclient.path.exists(smb_path): + logger.warn(f"【SMB】路径不存在,跳过删除: {fileitem.path}") + return True + if fileitem.type == "dir": # 递归删除目录及其内容 logger.debug(f"【SMB】递归删除目录: {smb_path}")