removed unused code

This commit is contained in:
Michael Jerger 2024-05-06 08:52:25 +02:00
parent c70b8d28a3
commit a485837b9c
2 changed files with 0 additions and 52 deletions

View file

@ -305,12 +305,6 @@ package "code.gitea.io/gitea/modules/translation"
package "code.gitea.io/gitea/modules/util/filebuffer" package "code.gitea.io/gitea/modules/util/filebuffer"
func CreateFromReader func CreateFromReader
package "code.gitea.io/gitea/modules/validation"
func IsValidForgejoActivityPubURL
func IsValidFollowingRepoURL
func IsValidFollowingRepoURLList
func IsOfValidLength
package "code.gitea.io/gitea/modules/web" package "code.gitea.io/gitea/modules/web"
func RouteMock func RouteMock
func RouteMockReset func RouteMockReset

View file

@ -8,7 +8,6 @@ import (
"net" "net"
"net/url" "net/url"
"regexp" "regexp"
"strconv"
"strings" "strings"
"code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/setting"
@ -118,51 +117,6 @@ func IsValidExternalTrackerURLFormat(uri string) bool {
return true return true
} }
func IsValidForgejoActivityPubURL(url string) bool {
if !IsValidURL(url) {
return false
}
if !strings.Contains(url, "api/v1/activitypub") {
return false
}
return true
}
func IsValidFollowingRepoURL(url string) bool {
if !IsValidForgejoActivityPubURL(url) {
return false
}
if !strings.Contains(url, "repository-id") {
return false
}
splitURL := strings.Split(url, "/")
repoIDIndex := len(splitURL) - 1
// Is there a valid integer denoting a repo id?
if _, err := strconv.Atoi(splitURL[repoIDIndex]); err != nil {
return false
}
return true
}
func IsValidFollowingRepoURLList(urls string) bool {
switch {
case len(strings.Split(urls, ";")) == 1:
return IsValidFollowingRepoURL(urls)
default:
for _, url := range strings.Split(urls, ";") {
if !IsValidFollowingRepoURLList(url) {
return false
}
}
}
return true
}
// TODO: use validateable/ValidateMaxLen instead !!
func IsOfValidLength(str string) bool {
return len(str) <= 2048
}
var ( var (
validUsernamePatternWithDots = regexp.MustCompile(`^[\da-zA-Z][-.\w]*$`) validUsernamePatternWithDots = regexp.MustCompile(`^[\da-zA-Z][-.\w]*$`)
validUsernamePatternWithoutDots = regexp.MustCompile(`^[\da-zA-Z][-\w]*$`) validUsernamePatternWithoutDots = regexp.MustCompile(`^[\da-zA-Z][-\w]*$`)