From 748dc78ead66d9542afec2852fbc599b66a8d991 Mon Sep 17 00:00:00 2001 From: Wim Date: Sun, 19 Jun 2022 12:49:19 +0200 Subject: [PATCH] Fix nakedreturns after merge --- modules/activitypub/client.go | 6 +++--- modules/activitypub/user_settings.go | 4 ++-- routers/api/v1/activitypub/reqsignature.go | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/activitypub/client.go b/modules/activitypub/client.go index 738b1e47372bb..9bcef69de18c5 100644 --- a/modules/activitypub/client.go +++ b/modules/activitypub/client.go @@ -92,7 +92,7 @@ func NewClient(user *user_model.User, pubID string) (c *Client, err error) { priv: privParsed, pubID: pubID, } - return + return c, err } // NewRequest function @@ -110,7 +110,7 @@ func (c *Client) NewRequest(b []byte, to string) (req *http.Request, err error) return } err = signer.SignRequest(c.priv, c.pubID, req, b) - return + return req, err } // Post function @@ -120,5 +120,5 @@ func (c *Client) Post(b []byte, to string) (resp *http.Response, err error) { return } resp, err = c.client.Do(req) - return + return resp, err } diff --git a/modules/activitypub/user_settings.go b/modules/activitypub/user_settings.go index 2144e7b47fb3b..fc9775b0f0cfa 100644 --- a/modules/activitypub/user_settings.go +++ b/modules/activitypub/user_settings.go @@ -35,11 +35,11 @@ func GetKeyPair(user *user_model.User) (pub, priv string, err error) { // GetPublicKey function returns a user's public key func GetPublicKey(user *user_model.User) (pub string, err error) { pub, _, err = GetKeyPair(user) - return + return pub, err } // GetPrivateKey function returns a user's private key func GetPrivateKey(user *user_model.User) (priv string, err error) { _, priv, err = GetKeyPair(user) - return + return priv, err } diff --git a/routers/api/v1/activitypub/reqsignature.go b/routers/api/v1/activitypub/reqsignature.go index b870d1c0f9ee4..5c0776602bc45 100644 --- a/routers/api/v1/activitypub/reqsignature.go +++ b/routers/api/v1/activitypub/reqsignature.go @@ -41,7 +41,7 @@ func getPublicKeyFromResponse(b []byte, keyID *url.URL) (p crypto.PublicKey, err return } p, err = x509.ParsePKIXPublicKey(block.Bytes) - return + return p, err } func fetch(iri *url.URL) (b []byte, err error) { @@ -59,7 +59,7 @@ func fetch(iri *url.URL) (b []byte, err error) { return } b, err = io.ReadAll(io.LimitReader(resp.Body, setting.Federation.MaxSize)) - return + return b, err } func verifyHTTPSignatures(ctx *gitea_context.APIContext) (authenticated bool, err error) { @@ -87,7 +87,7 @@ func verifyHTTPSignatures(ctx *gitea_context.APIContext) (authenticated bool, er // 3. Verify the other actor's key algo := httpsig.Algorithm(setting.Federation.Algorithms[0]) authenticated = v.Verify(pubKey, algo) == nil - return + return authenticated, err } // ReqHTTPSignature function