INNER CODE UNIT · Go
cgValidRoutePath
cc1a2b/JShunter · internal/jshunter/chunkgraph.go:177
func cgValidRoutePath(p string) bool {
if p == "" || len(p) > 256 {
return false
}
if strings.ContainsAny(p, " \t\n<>\"'`;{}") || strings.Contains(p, "://") {
return false
}
for _, ext := range cgChunkExts {
if strings.HasSuffix(p, ext) {
return false
}
}
if p[0] != '/' {
// A bare segment is a nested route only if it reads like one.
for i := 0; i < len(p); i++ {
c := p[i]
if !isIdentPart(c) && c != ':' && c != '-' && c != '*' && c != '.' {
return false