From a2359a1ad2b84862507b914807c055090d8fa1ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=99=AF=E5=A4=A7=E4=BE=A0?= Date: Sat, 24 Jan 2026 17:48:53 +0800 Subject: [PATCH] =?UTF-8?q?fix(u115):=20=E5=88=9B=E5=BB=BA=E7=9B=AE?= =?UTF-8?q?=E5=BD=95=E8=AF=AF=E6=8A=A5=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 解析响应时忽略20004错误码 - 根目录创建目录会报错ValueError --- app/modules/filemanager/storages/u115.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/modules/filemanager/storages/u115.py b/app/modules/filemanager/storages/u115.py index a1bb4e27..157ea3fc 100644 --- a/app/modules/filemanager/storages/u115.py +++ b/app/modules/filemanager/storages/u115.py @@ -268,7 +268,7 @@ class U115Pan(StorageBase, metaclass=WeakSingleton): # 返回数据 ret_data = resp.json() - if ret_data.get("code") != 0: + if ret_data.get("code") not in (0, 20004): error_msg = ret_data.get("message") if not no_error_log: logger.warn(f"【115】{method} 请求 {endpoint} 出错:{error_msg}") @@ -386,7 +386,10 @@ class U115Pan(StorageBase, metaclass=WeakSingleton): resp = self._request_api( "POST", "/open/folder/add", - data={"pid": int(parent_item.fileid or "0"), "file_name": name}, + data={ + "pid": 0 if parent_item.path == "/" else int(parent_item.fileid or 0), + "file_name": name, + }, ) if not resp: return None