Monorepo for Tangled tangled.org

appview: harder repo name validation

anirudh.fi a56aa0f8 cc344af0

verified
Changed files
+13 -1
appview
state
+13 -1
appview/state/state.go
··· 572 572 573 573 repoName := r.FormValue("name") 574 574 if repoName == "" { 575 - s.pages.Notice(w, "repo", "Invalid repo name.") 575 + s.pages.Notice(w, "repo", "Repository name cannot be empty.") 576 576 return 577 + } 578 + 579 + // Check for valid repository name (GitHub-like rules) 580 + // No spaces, only alphanumeric characters, dashes, and underscores 581 + for _, char := range repoName { 582 + if !((char >= 'a' && char <= 'z') || 583 + (char >= 'A' && char <= 'Z') || 584 + (char >= '0' && char <= '9') || 585 + char == '-' || char == '_' || char == '.') { 586 + s.pages.Notice(w, "repo", "Repository name can only contain alphanumeric characters, periods, hyphens, and underscores.") 587 + return 588 + } 577 589 } 578 590 579 591 defaultBranch := r.FormValue("branch")