diff --git a/internal/cmd/keepassxctemplatefuncs.go b/internal/cmd/keepassxctemplatefuncs.go index e86c68ef0cb..57fc07c2883 100644 --- a/internal/cmd/keepassxctemplatefuncs.go +++ b/internal/cmd/keepassxctemplatefuncs.go @@ -5,7 +5,6 @@ import ( "bytes" "errors" "fmt" - "github.com/tobischo/gokeepasslib/v3" "os" "os/exec" "regexp" @@ -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" @@ -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 @@ -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