Skip to content

Commit 1af3a0e

Browse files
DDSRemclaude
andauthored
fix: handle None items in alipan list to prevent TypeError (#5765)
When the Aliyun Drive API returns an error response (e.g. UserNotAllowedAccessDrive), resp.get("items") is None, causing len() to raise TypeError. Extract items with a safe default to fix the crash and avoid a potential infinite loop. Fix #5664 Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 5a58583 commit 1af3a0e

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

app/modules/filemanager/storages/alipan.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,9 +378,10 @@ def list(self, fileitem: schemas.FileItem) -> List[schemas.FileItem]:
378378
if not resp:
379379
break
380380
next_marker = resp.get("next_marker")
381-
for item in resp.get("items", []):
381+
current_items = resp.get("items") or []
382+
for item in current_items:
382383
items.append(self.__get_fileitem(item, parent=str(fileitem.path)))
383-
if len(resp.get("items")) < 100:
384+
if len(current_items) < 100:
384385
break
385386
return items
386387

0 commit comments

Comments
 (0)