Skip to content

Commit

Permalink
fix root group and attachment handling
Browse files Browse the repository at this point in the history
  • Loading branch information
bakito committed Dec 20, 2024
1 parent b441e8d commit 5396dc8
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions internal/cmd/keepassxctemplatefuncs.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"bytes"
"errors"
"fmt"
"github.com/tobischo/gokeepasslib/v3"
"os"
"os/exec"
"regexp"
Expand All @@ -15,6 +14,7 @@ import (
"time"

"github.com/coreos/go-semver/semver"
"github.com/tobischo/gokeepasslib/v3"
"github.com/twpayne/go-expect"

"github.com/twpayne/chezmoi/v2/internal/chezmoi"
Expand Down Expand Up @@ -384,7 +384,7 @@ func (c *Config) keepassxcBuiltinExtractValues(
panic(err)
}

return keepassxcBuiltinBuildCache(db, "", db.Content.Root.Groups, nil, mapper)
return keepassxcBuiltinBuildCache(db, "", db.Content.Root.Groups[0].Groups, nil, mapper)
}

// keepassxcBuiltinBuildCache build the builtin cache using a given mapper function
Expand Down Expand Up @@ -428,7 +428,11 @@ func keepassxcBuiltinMapAttachmentCache(db *gokeepasslib.Database, entry gokeepa
for _, bin := range entry.Binaries {
b := db.FindBinary(bin.Value.ID)
if b != nil {
m[bin.Name] = string(b.Content)
str, err := b.GetContentString()
if err != nil {
panic(err)
}
m[bin.Name] = str
}
}
return m
Expand Down

0 comments on commit 5396dc8

Please sign in to comment.