remove duplicate check for ".."

This commit is contained in:
Blake Mizerany 2024-04-24 15:04:41 -07:00
parent 1b21a22d0e
commit 39a199bb3e

View File

@ -205,7 +205,7 @@ func MustParseName(s, fill string) Name {
// //
// The returned Name will only be valid if dst is valid. // The returned Name will only be valid if dst is valid.
// //
// It skipps fill parts that are "?". // It skips fill parts that are "?".
func fillName(r Name, fill string) Name { func fillName(r Name, fill string) Name {
fill = cmp.Or(fill, FillDefault) fill = cmp.Or(fill, FillDefault)
f := parseMask(fill) f := parseMask(fill)
@ -479,7 +479,6 @@ func parts(s string) iter_Seq2[PartKind, string] {
return return
} }
numConsecutiveDots := 0
partLen := 0 partLen := 0
state, j := PartDigest, len(s) state, j := PartDigest, len(s)
for i := len(s) - 1; i >= 0; i-- { for i := len(s) - 1; i >= 0; i-- {
@ -551,15 +550,6 @@ func parts(s string) iter_Seq2[PartKind, string] {
yield(PartExtraneous, s[i+1:j]) yield(PartExtraneous, s[i+1:j])
return return
} }
default:
if s[i] == '.' {
if numConsecutiveDots++; numConsecutiveDots > 1 {
yield(state, "")
return
}
} else {
numConsecutiveDots = 0
}
} }
} }