mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-01 02:57:59 +00:00
The big one (#5346)
This commit is contained in:
@@ -3,7 +3,6 @@ package namespace
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"strings"
|
||||
)
|
||||
|
||||
@@ -27,10 +26,6 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
var AdjustRequest = func(r *http.Request) (*http.Request, int) {
|
||||
return r.WithContext(ContextWithNamespace(r.Context(), RootNamespace)), 0
|
||||
}
|
||||
|
||||
func (n *Namespace) HasParent(possibleParent *Namespace) bool {
|
||||
switch {
|
||||
case n.Path == "":
|
||||
@@ -105,3 +100,15 @@ func Canonicalize(nsPath string) string {
|
||||
|
||||
return nsPath
|
||||
}
|
||||
|
||||
func SplitIDFromString(input string) (string, string) {
|
||||
idx := strings.LastIndex(input, ".")
|
||||
if idx == -1 {
|
||||
return input, ""
|
||||
}
|
||||
if idx == len(input)-1 {
|
||||
return input, ""
|
||||
}
|
||||
|
||||
return input[:idx], input[idx+1:]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user