tangled
alpha
login
or
join now
willdot.net
/
tangled-fork
forked from
tangled.org/core
0
fork
atom
Monorepo for Tangled
0
fork
atom
overview
issues
pulls
pipelines
appview: harder repo name validation
anirudh.fi
1 year ago
a56aa0f8
cc344af0
verified
This commit was signed with the committer's
known signature
.
anirudh.fi
SSH Key Fingerprint:
SHA256:cz35vdbiWEzCNEfuL9fMC2JVIhtXavXBHrRjv8gxpAk=
+13
-1
1 changed file
expand all
collapse all
unified
split
appview
state
state.go
+13
-1
appview/state/state.go
···
572
572
573
573
repoName := r.FormValue("name")
574
574
if repoName == "" {
575
575
-
s.pages.Notice(w, "repo", "Invalid repo name.")
575
575
+
s.pages.Notice(w, "repo", "Repository name cannot be empty.")
576
576
return
577
577
+
}
578
578
+
579
579
+
// Check for valid repository name (GitHub-like rules)
580
580
+
// No spaces, only alphanumeric characters, dashes, and underscores
581
581
+
for _, char := range repoName {
582
582
+
if !((char >= 'a' && char <= 'z') ||
583
583
+
(char >= 'A' && char <= 'Z') ||
584
584
+
(char >= '0' && char <= '9') ||
585
585
+
char == '-' || char == '_' || char == '.') {
586
586
+
s.pages.Notice(w, "repo", "Repository name can only contain alphanumeric characters, periods, hyphens, and underscores.")
587
587
+
return
588
588
+
}
577
589
}
578
590
579
591
defaultBranch := r.FormValue("branch")