mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-24 08:57:03 -05:00
removed unused code
This commit is contained in:
parent
c70b8d28a3
commit
a485837b9c
2 changed files with 0 additions and 52 deletions
|
@ -305,12 +305,6 @@ package "code.gitea.io/gitea/modules/translation"
|
|||
package "code.gitea.io/gitea/modules/util/filebuffer"
|
||||
func CreateFromReader
|
||||
|
||||
package "code.gitea.io/gitea/modules/validation"
|
||||
func IsValidForgejoActivityPubURL
|
||||
func IsValidFollowingRepoURL
|
||||
func IsValidFollowingRepoURLList
|
||||
func IsOfValidLength
|
||||
|
||||
package "code.gitea.io/gitea/modules/web"
|
||||
func RouteMock
|
||||
func RouteMockReset
|
||||
|
|
|
@ -8,7 +8,6 @@ import (
|
|||
"net"
|
||||
"net/url"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
|
@ -118,51 +117,6 @@ func IsValidExternalTrackerURLFormat(uri string) bool {
|
|||
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 (
|
||||
validUsernamePatternWithDots = regexp.MustCompile(`^[\da-zA-Z][-.\w]*$`)
|
||||
validUsernamePatternWithoutDots = regexp.MustCompile(`^[\da-zA-Z][-\w]*$`)
|
||||
|
|
Loading…
Reference in a new issue