command/namespace: Move trailing slash check to the end (#5163)
This commit is contained in:
parent
18b21275d9
commit
5812a84c28
|
@ -85,12 +85,14 @@ func (c *NamespaceCreateCommand) Run(args []string) int {
|
|||
return 2
|
||||
}
|
||||
|
||||
if !strings.HasSuffix(namespacePath, "/") {
|
||||
namespacePath = namespacePath + "/"
|
||||
}
|
||||
if c.flagNamespace != notSetNamespace {
|
||||
namespacePath = path.Join(c.flagNamespace, namespacePath)
|
||||
}
|
||||
|
||||
if !strings.HasSuffix(namespacePath, "/") {
|
||||
namespacePath = namespacePath + "/"
|
||||
}
|
||||
|
||||
// Output full path
|
||||
c.UI.Output(fmt.Sprintf("Success! Namespace created at: %s", namespacePath))
|
||||
return 0
|
||||
|
|
|
@ -90,13 +90,14 @@ func (c *NamespaceDeleteCommand) Run(args []string) int {
|
|||
return OutputSecret(c.UI, secret)
|
||||
}
|
||||
|
||||
if !strings.HasSuffix(namespacePath, "/") {
|
||||
namespacePath = namespacePath + "/"
|
||||
}
|
||||
if c.flagNamespace != notSetNamespace {
|
||||
namespacePath = path.Join(c.flagNamespace, namespacePath)
|
||||
}
|
||||
|
||||
if !strings.HasSuffix(namespacePath, "/") {
|
||||
namespacePath = namespacePath + "/"
|
||||
}
|
||||
|
||||
c.UI.Output(fmt.Sprintf("Success! Namespace deleted at: %s", namespacePath))
|
||||
return 0
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue