From 13bf84e89e590ae1fa2d5ef0a96342d94f5a75e4 Mon Sep 17 00:00:00 2001 From: erik Date: Wed, 20 Mar 2024 16:12:20 +0100 Subject: [PATCH] Implent checking for list of repos --- modules/validation/helpers.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/modules/validation/helpers.go b/modules/validation/helpers.go index 5edfe8d3c2..677c2f3b9d 100644 --- a/modules/validation/helpers.go +++ b/modules/validation/helpers.go @@ -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]*$`)