From f8630348b4c14215d87921962a2acbe8d3b6c981 Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Mon, 22 Nov 2021 08:46:19 +0100 Subject: 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 --- internal/processing/federation/getuser.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'internal/processing/federation/getuser.go') 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")) } -- cgit v1.2.3