From ff0bc0f0aef22b748459d16a986030240a226c8c Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Thu, 30 Mar 2023 23:31:15 +0200 Subject: [PATCH] fix lint & co --- integration/get_test.go | 3 ++- server/upstream/redirects.go | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/integration/get_test.go b/integration/get_test.go index 3666440..cfb7188 100644 --- a/integration/get_test.go +++ b/integration/get_test.go @@ -1,4 +1,5 @@ - +//go:build integration +// +build integration package integration diff --git a/server/upstream/redirects.go b/server/upstream/redirects.go index b0e164d..ab6c971 100644 --- a/server/upstream/redirects.go +++ b/server/upstream/redirects.go @@ -68,8 +68,8 @@ func (o *Options) matchRedirects(ctx *context.Context, giteaClient *gitea.Client for _, redirect := range redirects { reqUrl := ctx.Req.RequestURI // remove repo and branch from request url - reqUrl = strings.TrimPrefix(reqUrl, "/" + o.TargetRepo) - reqUrl = strings.TrimPrefix(reqUrl, "/@" + o.TargetBranch) + reqUrl = strings.TrimPrefix(reqUrl, "/"+o.TargetRepo) + reqUrl = strings.TrimPrefix(reqUrl, "/@"+o.TargetBranch) // check if from url matches request url if strings.TrimSuffix(redirect.From, "/") == strings.TrimSuffix(reqUrl, "/") { @@ -112,6 +112,6 @@ func (o *Options) matchRedirects(ctx *context.Context, giteaClient *gitea.Client } } } - + return false -} \ No newline at end of file +}