mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-10 04:05:42 +01:00
Implent checking for list of repos
This commit is contained in:
parent
3dda92b52b
commit
13bf84e89e
1 changed files with 14 additions and 0 deletions
|
@ -143,6 +143,20 @@ func IsValidFederatedRepoURL(url string) bool {
|
|||
return true
|
||||
}
|
||||
|
||||
func IsValidFederatedRepoURLList(urls string) bool {
|
||||
switch {
|
||||
case len(strings.Split(urls, ";")) == 1:
|
||||
return IsValidFederatedRepoURL(urls)
|
||||
default:
|
||||
for _, url := range strings.Split(urls, ";") {
|
||||
if !IsValidFederatedRepoURLList(url) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
var (
|
||||
validUsernamePatternWithDots = regexp.MustCompile(`^[\da-zA-Z][-.\w]*$`)
|
||||
validUsernamePatternWithoutDots = regexp.MustCompile(`^[\da-zA-Z][-\w]*$`)
|
||||
|
|
Loading…
Reference in a new issue