Cleanup, handle invalid usernames for ActivityPub person GET request

Signed-off-by: Anthony Wang <ta180m@pm.me>
This commit is contained in:
Anthony Wang
2022-03-24 18:44:44 -05:00
parent ebef769703
commit 46973f99fa
3 changed files with 6 additions and 4 deletions

View File

@@ -13,6 +13,7 @@ import (
"io"
"net/http"
"net/url"
"time"
"code.gitea.io/gitea/modules/activitypub"
gitea_context "code.gitea.io/gitea/modules/context"
@@ -99,7 +100,7 @@ func fetch(iri *url.URL) (b []byte, err error) {
if err != nil {
return
}
req.Header.Add("Date", fmt.Sprintf("%s GMT", clock.Now().UTC().Format("Mon, 02 Jan 2006 15:04:05")))
req.Header.Add("Date", fmt.Sprintf("%s GMT", clock.Now().UTC().Format(time.RFC1123)))
var resp *http.Response
client := &http.Client{}
resp, err = client.Do(req)