From 281252f6865156aa52ad335719aa178715e53ae7 Mon Sep 17 00:00:00 2001 From: mkol5222 Date: Tue, 19 Sep 2023 08:56:37 +0200 Subject: [PATCH] keepass: unexpected leading slash for root items (#188) --- pkg/providers/keypass.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pkg/providers/keypass.go b/pkg/providers/keypass.go index 63eb9bef..e8a8a766 100644 --- a/pkg/providers/keypass.go +++ b/pkg/providers/keypass.go @@ -24,7 +24,7 @@ type KeyPass struct { const KeyPassName = "KeyPass" -//nolint +// nolint func init() { metaInfo := core.MetaInfo{ Description: "Keypass", @@ -177,7 +177,12 @@ func (k *KeyPass) prepareGroups(path string, groups []gokeepasslib.Group, mapDat // if entries found, adding the entry data fo the list if len(group.Entries) > 0 { for _, entry := range group.Entries { //nolint - mapData[fmt.Sprintf("%s/%s/%s", path, group.Name, entry.GetTitle())] = entry + if path == "" { // prevent unexpected leading slash for entries in root + mapData[fmt.Sprintf("%s/%s", group.Name, entry.GetTitle())] = entry + } else { + mapData[fmt.Sprintf("%s/%s/%s", path, group.Name, entry.GetTitle())] = entry + } + } } if len(group.Groups) > 0 {