forked from tangled.org/core
this repo has no description

appview: harder repo name validation

anirudh.fi a56aa0f8 cc344af0

verified
Changed files
+13 -1
appview
state
+13 -1
appview/state/state.go
···
repoName := r.FormValue("name")
if repoName == "" {
-
s.pages.Notice(w, "repo", "Invalid repo name.")
+
s.pages.Notice(w, "repo", "Repository name cannot be empty.")
return
+
}
+
+
// Check for valid repository name (GitHub-like rules)
+
// No spaces, only alphanumeric characters, dashes, and underscores
+
for _, char := range repoName {
+
if !((char >= 'a' && char <= 'z') ||
+
(char >= 'A' && char <= 'Z') ||
+
(char >= '0' && char <= '9') ||
+
char == '-' || char == '_' || char == '.') {
+
s.pages.Notice(w, "repo", "Repository name can only contain alphanumeric characters, periods, hyphens, and underscores.")
+
return
+
}
}
defaultBranch := r.FormValue("branch")