Skip to content

Commit

Permalink
Fix nakedreturns after merge
Browse files Browse the repository at this point in the history
  • Loading branch information
42wim committed Jun 19, 2022
1 parent 650d02a commit 748dc78
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions modules/activitypub/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
}
4 changes: 2 additions & 2 deletions modules/activitypub/user_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
6 changes: 3 additions & 3 deletions routers/api/v1/activitypub/reqsignature.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 748dc78

Please sign in to comment.