fix: workspace_tree id=__root__ returns children

This commit is contained in:
p 2026-08-12 16:51:30 +08:00
parent 340dcf0fd0
commit 61fb3f6485

View File

@ -29,13 +29,12 @@ async with DBPools().sqlorContext(dbname) as sor:
ws_dir = ws if ws.startswith('/') else workspace_base + '/' + org_id + '/' + pname ws_dir = ws if ws.startswith('/') else workspace_base + '/' + org_id + '/' + pname
if not ws_dir or not os.path.isdir(ws_dir): if not ws_dir or not os.path.isdir(ws_dir):
if not node_id or node_id == '__root__': if not node_id:
return [{"id": "__root__", "parentid": "", "label": "📁 工作空间(不可用)", "path": "", "is_leaf": False}] return [{"id": "__root__", "parentid": "", "label": "📁 工作空间(不可用)", "path": "", "is_leaf": False}]
return [] return []
# 确定要扫描的目录 # 初始加载:无 id 参数,只返回根节点
if not node_id or node_id == '__root__': if not node_id:
# 初始加载:返回根节点
return [{ return [{
"id": "__root__", "id": "__root__",
"parentid": "", "parentid": "",