From 080460d5fda3af56cf456a6bd83a8b2188a7e4f7 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 0000000000000..2c213120562ed --- /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 b058ba2d54947..354368e3f048d 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)