summaryrefslogtreecommitdiff
path: root/internal/processing/federation/getuser.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2021-11-22 08:46:19 +0100
committerLibravatar GitHub <noreply@github.com>2021-11-22 08:46:19 +0100
commitf8630348b4c14215d87921962a2acbe8d3b6c981 (patch)
tree8a06b1e91ca408de2451a79fee44de831456d729 /internal/processing/federation/getuser.go
parenttidy up database creation logic a bit (#317) (diff)
downloadgotosocial-f8630348b4c14215d87921962a2acbe8d3b6c981.tar.xz
Enable stricter linting with golangci-lint (#316)
* update golangci-lint * add golangci config file w/ more linters * correct issues flagged by stricter linters * add more generous timeout for golangci-lint * add some style + formatting guidelines * move timeout to config file * go fmt
Diffstat (limited to 'internal/processing/federation/getuser.go')
-rw-r--r--internal/processing/federation/getuser.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/internal/processing/federation/getuser.go b/internal/processing/federation/getuser.go
index 37444bf5d..bde3d58de 100644
--- a/internal/processing/federation/getuser.go
+++ b/internal/processing/federation/getuser.go
@@ -38,13 +38,14 @@ func (p *processor) GetUser(ctx context.Context, requestedUsername string, reque
}
var requestedPerson vocab.ActivityStreamsPerson
- if util.IsPublicKeyPath(requestURL) {
+ switch {
+ case util.IsPublicKeyPath(requestURL):
// if it's a public key path, we don't need to authenticate but we'll only serve the bare minimum user profile needed for the public key
requestedPerson, err = p.tc.AccountToASMinimal(ctx, requestedAccount)
if err != nil {
return nil, gtserror.NewErrorInternalError(err)
}
- } else if util.IsUserPath(requestURL) {
+ case util.IsUserPath(requestURL):
// if it's a user path, we want to fully authenticate the request before we serve any data, and then we can serve a more complete profile
requestingAccountURI, authenticated, err := p.federator.AuthenticateFederatedRequest(ctx, requestedUsername)
if err != nil || !authenticated {
@@ -72,7 +73,7 @@ func (p *processor) GetUser(ctx context.Context, requestedUsername string, reque
if err != nil {
return nil, gtserror.NewErrorInternalError(err)
}
- } else {
+ default:
return nil, gtserror.NewErrorBadRequest(fmt.Errorf("path was not public key path or user path"))
}