From c79cd1c744599f7d0cc3d511db4ade711842e19a Mon Sep 17 00:00:00 2001 From: hghaf099 <83242695+hghaf099@users.noreply.github.com> Date: Fri, 22 Oct 2021 17:47:16 -0400 Subject: [PATCH] fixing a bug for cli when namespace is in both arg and path (#12911) * fixing a bug for cli when namespace is in both arg and path * Add a changelog --- changelog/12911.txt | 3 +++ command/kv_helpers.go | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 changelog/12911.txt diff --git a/changelog/12911.txt b/changelog/12911.txt new file mode 100644 index 000000000..2c2131205 --- /dev/null +++ b/changelog/12911.txt @@ -0,0 +1,3 @@ +```release-note:bug +cli: fixes CLI requests when namespace is both provided as argument and part of the path +``` diff --git a/command/kv_helpers.go b/command/kv_helpers.go index b058ba2d5..354368e3f 100644 --- a/command/kv_helpers.go +++ b/command/kv_helpers.go @@ -124,8 +124,8 @@ func addPrefixToVKVPath(p, mountPath, apiPrefix string) string { if len(partialMountPath) <= 1 || partialMountPath[1] == ""{ break } - mountPath = partialMountPath[1] - tp = strings.TrimPrefix(p, mountPath) + mountPath = strings.TrimSuffix(partialMountPath[1], "/") + tp = strings.TrimPrefix(tp, mountPath) } return path.Join(mountPath, apiPrefix, tp)