Batch tokens (#755)

This commit is contained in:
Jeff Mitchell
2018-10-15 12:56:24 -04:00
committed by GitHub
parent 8db6aabee1
commit a58d313d2b
51 changed files with 2170 additions and 570 deletions

View File

@@ -104,7 +104,18 @@ func Canonicalize(nsPath string) string {
func SplitIDFromString(input string) (string, string) {
prefix := ""
slashIdx := strings.LastIndex(input, "/")
if slashIdx > 0 {
switch {
case strings.HasPrefix(input, "b."):
prefix = "b."
input = input[2:]
case strings.HasPrefix(input, "s."):
prefix = "s."
input = input[2:]
case slashIdx > 0:
// Leases will never have a b./s. to start
if slashIdx == len(input)-1 {
return input, ""
}