mirror of
1
Fork 0
This commit is contained in:
erik 2024-03-26 16:56:06 +01:00
parent 01e9853161
commit 84f73d9db8
1 changed files with 5 additions and 2 deletions

View File

@ -8,6 +8,7 @@ import (
"net/url" "net/url"
"strings" "strings"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/validation" "code.gitea.io/gitea/modules/validation"
@ -58,7 +59,7 @@ func (id ActorID) Validate() []string {
result = append(result, validation.ValidateNotEmpty(id.UnvalidatedInput, "unvalidatedInput")...) result = append(result, validation.ValidateNotEmpty(id.UnvalidatedInput, "unvalidatedInput")...)
if id.UnvalidatedInput != id.AsURI() { if id.UnvalidatedInput != id.AsURI() {
result = append(result, fmt.Sprintf("not all input: %q was parsed: %q", id.UnvalidatedInput, id.AsURI())) result = append(result, fmt.Sprintf("not all input was parsed, \nUnvalidated Input:%q \nParsed URI: %q", id.UnvalidatedInput, id.AsURI()))
} }
return result return result
@ -178,6 +179,8 @@ func removeEmptyStrings(ls []string) []string {
func newActorID(uri string) (ActorID, error) { func newActorID(uri string) (ActorID, error) {
validatedURI, err := url.ParseRequestURI(uri) validatedURI, err := url.ParseRequestURI(uri)
log.Info("Validated URI is: %v", validatedURI)
log.Info("Input is: %v", validatedURI)
if err != nil { if err != nil {
return ActorID{}, err return ActorID{}, err
} }
@ -195,7 +198,7 @@ func newActorID(uri string) (ActorID, error) {
result.Host = validatedURI.Hostname() result.Host = validatedURI.Hostname()
result.Path = pathWithoutActorID result.Path = pathWithoutActorID
result.Port = validatedURI.Port() result.Port = validatedURI.Port()
result.UnvalidatedInput = validatedURI.String() result.UnvalidatedInput = validatedURI.String() // ToDo: Whats happening here?
return result, nil return result, nil
} }