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
This commit is contained in:
hghaf099 2021-10-22 17:47:16 -04:00 committed by GitHub
parent 96c49ee528
commit c79cd1c744
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

3
changelog/12911.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:bug
cli: fixes CLI requests when namespace is both provided as argument and part of the path
```

View File

@ -124,8 +124,8 @@ func addPrefixToVKVPath(p, mountPath, apiPrefix string) string {
if len(partialMountPath) <= 1 || partialMountPath[1] == ""{ if len(partialMountPath) <= 1 || partialMountPath[1] == ""{
break break
} }
mountPath = partialMountPath[1] mountPath = strings.TrimSuffix(partialMountPath[1], "/")
tp = strings.TrimPrefix(p, mountPath) tp = strings.TrimPrefix(tp, mountPath)
} }
return path.Join(mountPath, apiPrefix, tp) return path.Join(mountPath, apiPrefix, tp)