fix: Group tree path

This commit is contained in:
Piotr Dec 2025-10-16 23:10:04 +02:00
parent e310930d9e
commit 5224fe78b6
Signed by: stawros
GPG key ID: 74B18A3F0F1E99C0

View file

@ -47,16 +47,8 @@ class PasswordsController:
return e return e
def _node_of_group(self, g: Group) -> NodeDTO: def _node_of_group(self, g: Group) -> NodeDTO:
def group_path(gr: Group) -> str: raw_path = g.path
names: List[str] = [] path = "/" + "/".join(raw_path) if raw_path else "/"
cur = gr
while cur and cur.name:
names.append(cur.name)
cur = cur.parent
names.reverse()
return "/" + "/".join(names) if names else "/"
path = group_path(g)
groups = [self._node_of_group(sg) for sg in g.subgroups] groups = [self._node_of_group(sg) for sg in g.subgroups]
entries = [EntryNodeDTO( entries = [EntryNodeDTO(
kind=EntryKind.complex if (e.username or e.url or e.notes) else EntryKind.simple, kind=EntryKind.complex if (e.username or e.url or e.notes) else EntryKind.simple,