The big one (#5346)

This commit is contained in:
Jeff Mitchell
2018-09-17 23:03:00 -04:00
committed by GitHub
parent 07f5a27d85
commit b7d6d55ac1
156 changed files with 11177 additions and 5181 deletions

View File

@@ -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:]
}