From cc334eff4306536343533ca30f8bab6dc886c707 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=98=99=E2=97=A6=20The=20Tablet=20=E2=9D=80=20GamerGirla?= =?UTF-8?q?ndCo=20=E2=97=A6=E2=9D=A7?= Date: Sun, 23 Nov 2025 17:33:11 -0500 Subject: [PATCH] remove redundant return value from `fillPathParts` --- modules/git/url/url.go | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/modules/git/url/url.go b/modules/git/url/url.go index 69259b9e70..861573ee87 100644 --- a/modules/git/url/url.go +++ b/modules/git/url/url.go @@ -123,7 +123,7 @@ func ParseRepositoryURL(ctx context.Context, repoURL string) (*RepositoryURL, er ret := &RepositoryURL{} ret.GitURL = parsed - fillPathParts := func(s string) error { + fillPathParts := func(s string) { s = strings.TrimPrefix(s, "/") fields := strings.SplitN(s, "/", 4) var pathErr error @@ -134,7 +134,7 @@ func ParseRepositoryURL(ctx context.Context, repoURL string) (*RepositoryURL, er if pathErr != nil { ret.RepoName = strings.TrimSuffix(fields[1], ".git") ret.RemainingPath = "/" + fields[2] - return nil + return } ret.RepoName = strings.TrimSuffix(fields[2], ".git") if len(fields) >= 4 { @@ -142,7 +142,7 @@ func ParseRepositoryURL(ctx context.Context, repoURL string) (*RepositoryURL, er } } } - return nil + return } switch parsed.URL.Scheme { @@ -150,9 +150,7 @@ func ParseRepositoryURL(ctx context.Context, repoURL string) (*RepositoryURL, er if !httplib.IsCurrentGiteaSiteURL(ctx, repoURL) { return ret, nil } - if err = fillPathParts(strings.TrimPrefix(parsed.URL.Path, setting.AppSubURL)); err != nil { - return nil, err - } + fillPathParts(strings.TrimPrefix(parsed.URL.Path, setting.AppSubURL)) case "ssh", "git+ssh": domainSSH := setting.SSH.Domain domainCur := httplib.GuessCurrentHostDomain(ctx) @@ -166,9 +164,7 @@ func ParseRepositoryURL(ctx context.Context, repoURL string) (*RepositoryURL, er // check whether URL domain is current domain from context domainMatches = domainMatches || (domainCur != "" && domainCur == urlDomain) if domainMatches { - if err = fillPathParts(parsed.URL.Path); err != nil { - return nil, err - } + fillPathParts(parsed.URL.Path) } } return ret, nil