tree: fix __root__ expansion returns subdirs

This commit is contained in:
p 2026-08-13 14:26:56 +08:00
parent 751c953ad3
commit e0d095cb04

View File

@ -43,8 +43,14 @@ if not node_id:
"is_leaf": False
}]
# 展开节点
scan_path = ws_dir + '/' + node_id
# 展开节点__root__ 特殊处理,其余用相对路径
if node_id == '__root__':
scan_path = ws_dir
id_prefix = ''
else:
scan_path = ws_dir + '/' + node_id
id_prefix = node_id + '/'
if not os.path.isdir(scan_path):
return []
@ -60,7 +66,7 @@ for name in entries:
continue
if os.path.isdir(full):
items.append({
"id": node_id + '/' + name,
"id": id_prefix + name,
"parentid": node_id,
"label": "📁 " + name,
"path": full,