diff --git a/internal/action/binary.go b/internal/action/binary.go index b2c468e443..58dc96cb98 100644 --- a/internal/action/binary.go +++ b/internal/action/binary.go @@ -233,7 +233,7 @@ func (s *Action) binaryGet(ctx context.Context, name string) ([]byte, error) { return nil, fmt.Errorf("failed to read %q from the store: %w", name, err) } - if cte, _ := sec.Get("content-transfer-encoding"); cte != "Base64" { + if cte, _ := sec.Get("Content-Transfer-Encoding"); cte != "Base64" { // need to use sec.Bytes() otherwise the first line is missing. return sec.Bytes(), nil } diff --git a/internal/action/show.go b/internal/action/show.go index 501738d14b..7b164b0e81 100644 --- a/internal/action/show.go +++ b/internal/action/show.go @@ -161,6 +161,19 @@ func (s *Action) parseRevision(ctx context.Context, name, revision string) (stri return revision, nil } +func (s *Action) showHandleOutputChars(ctx context.Context, pw string, chars []int) error { + for _, c := range chars { + if c > len(pw) || c-1 < 0 { + debug.Log("Invalid char: %d", c) + + continue + } + out.Printf(ctx, "%d: %s", c, out.Secret(pw[c-1])) + } + + return nil +} + // showHandleOutput displays a secret. func (s *Action) showHandleOutput(ctx context.Context, name string, sec gopass.Secret) error { pw, body, err := s.showGetContent(ctx, sec) @@ -169,16 +182,7 @@ func (s *Action) showHandleOutput(ctx context.Context, name string, sec gopass.S } if chars := GetPrintChars(ctx); len(chars) > 0 { - for _, c := range chars { - if c > len(pw) || c-1 < 0 { - debug.Log("Invalid char: %d", c) - - continue - } - out.Printf(ctx, "%d: %s", c, out.Secret(pw[c-1])) - } - - return nil + return s.showHandleOutputChars(ctx, pw, chars) } if pw == "" && body == "" { @@ -231,9 +235,6 @@ func (s *Action) showGetContent(ctx context.Context, sec gopass.Secret) (string, val := strings.Join(values, "\n") return val, val, nil - } else if HasKey(ctx) { - out.Warning(ctx, "Parsing is disabled but a key was provided.") - debug.Log("attempting to parse key %s with parsing disabled", GetKey(ctx)) } pw := sec.Password() diff --git a/pkg/gopass/secrets/akv.go b/pkg/gopass/secrets/akv.go index 1104ddfc0a..0b2294d6da 100644 --- a/pkg/gopass/secrets/akv.go +++ b/pkg/gopass/secrets/akv.go @@ -63,8 +63,6 @@ func (a *AKV) Keys() []string { // Get returns the value of the requested key, if found. func (a *AKV) Get(key string) (string, bool) { - key = strings.ToLower(key) - if v, found := a.kvp[key]; found { return v[0], true } @@ -74,8 +72,6 @@ func (a *AKV) Get(key string) (string, bool) { // Values returns all values for that key. func (a *AKV) Values(key string) ([]string, bool) { - key = strings.ToLower(key) - v, found := a.kvp[key] return v, found @@ -83,8 +79,6 @@ func (a *AKV) Values(key string) ([]string, bool) { // Set writes a single key. func (a *AKV) Set(key string, value any) error { - key = strings.ToLower(key) - // if it's new key we can just append it at the end if _, found := a.kvp[key]; !found { return a.Add(key, value) @@ -146,8 +140,6 @@ func (a *AKV) Set(key string, value any) error { // Add appends data to a given key. func (a *AKV) Add(key string, value any) error { - key = strings.ToLower(key) - sv := fmt.Sprintf("%s", value) a.kvp[key] = append(a.kvp[key], sv) @@ -158,8 +150,6 @@ func (a *AKV) Add(key string, value any) error { // Del removes a given key and all of its values. func (a *AKV) Del(key string) bool { - key = strings.ToLower(key) - _, found := a.kvp[key] if !found { return false @@ -270,7 +260,6 @@ func ParseAKV(in []byte) *AKV { key = strings.TrimSpace(key) val = strings.TrimSpace(val) // we only store lower case keys for KV - key = strings.ToLower(key) a.kvp[key] = append(a.kvp[key], val) }