Skip to content

Commit

Permalink
keepass: unexpected leading slash for root items (#188)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkol5222 authored Sep 19, 2023
1 parent e1aecc3 commit 281252f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pkg/providers/keypass.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type KeyPass struct {

const KeyPassName = "KeyPass"

//nolint
// nolint
func init() {
metaInfo := core.MetaInfo{
Description: "Keypass",
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 281252f

Please sign in to comment.