diff --git a/changelog/15188.txt b/changelog/15188.txt new file mode 100644 index 000000000000..4435ccbb0de4 --- /dev/null +++ b/changelog/15188.txt @@ -0,0 +1,3 @@ +```release-note:bug +cli: kv get command now honors trailing spaces to retrieve secrets +``` diff --git a/command/kv_get.go b/command/kv_get.go index 07033448187a..ce4f60a76330 100644 --- a/command/kv_get.go +++ b/command/kv_get.go @@ -124,7 +124,8 @@ func (c *KVGetCommand) Run(args []string) int { // Parse the paths and grab the KV version if mountFlagSyntax { // In this case, this arg is the secret path (e.g. "foo"). - partialPath = sanitizePath(args[0]) + partialPath = args[0] + mountPath = sanitizePath(c.flagMount) _, v2, err = isKVv2(mountPath, client) if err != nil { @@ -134,7 +135,8 @@ func (c *KVGetCommand) Run(args []string) int { } else { // In this case, this arg is a path-like combination of mountPath/secretPath. // (e.g. "secret/foo") - partialPath = sanitizePath(args[0]) + partialPath = args[0] + mountPath, v2, err = isKVv2(partialPath, client) if err != nil { c.UI.Error(err.Error())