From acf1cb1dc4ce08aad28905a95a8b870e93181b58 Mon Sep 17 00:00:00 2001 From: Blake Mizerany Date: Thu, 4 Apr 2024 00:41:13 -0700 Subject: [PATCH] x/build/blob: fix handling of slash prefixes --- x/build/blob/ref.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/x/build/blob/ref.go b/x/build/blob/ref.go index 32fddb08..a925a928 100644 --- a/x/build/blob/ref.go +++ b/x/build/blob/ref.go @@ -218,12 +218,10 @@ func Parts(s string) iter.Seq2[PartKind, string] { if len(s) > 255 || len(s) == 0 { return } - if !isValidPart(string(s[0])) { - return - } yieldValid := func(kind PartKind, value string) bool { if !isValidPart(value) { + yield(Invalid, "") return false } return yield(kind, value) @@ -264,9 +262,12 @@ func Parts(s string) iter.Seq2[PartKind, string] { return } state, j = Domain, i - default: + case Domain: + // domain is not allowed to have slashes yield(Invalid, "") return + default: + return } } }