From a093b0b5a339a041299a72eb16262a8531f28a70 Mon Sep 17 00:00:00 2001 From: pandareen <7270563+pandareen@users.noreply.github.com> Date: Fri, 8 May 2026 12:50:25 +0530 Subject: [PATCH] Fix #37564: Rename to StripURL - lint review --- modules/util/url.go | 6 +++--- modules/util/url_test.go | 4 ++-- routers/web/auth/oauth.go | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/util/url.go b/modules/util/url.go index ea9fe79c2e..358614f281 100644 --- a/modules/util/url.go +++ b/modules/util/url.go @@ -27,7 +27,7 @@ func SanitizeURL(s string) (string, error) { return u.String(), nil } -// StripUrl returns the scheme, host, and path portions of s with userinfo, +// StripURL returns the scheme, host, and path portions of s with userinfo, // query string, and fragment removed. Intended for logging URLs whose // userinfo or query string may carry credentials (e.g. https://user:pass@… // or signed S3/GCS/Cloudinary URLs whose signatures live in the query @@ -35,8 +35,8 @@ func SanitizeURL(s string) (string, error) { // // Unlike SanitizeURL (which only strips userinfo and is used by callers // such as mirroring/indexing/migrations that still need the query string -// to actually use the URL), StripUrl is for logging only. -func StripUrl(s string) string { +// to actually use the URL), StripURL is for logging only. +func StripURL(s string) string { u, err := url.Parse(s) if err != nil { return "" diff --git a/modules/util/url_test.go b/modules/util/url_test.go index 4bb06ecde3..1d6e678e5e 100644 --- a/modules/util/url_test.go +++ b/modules/util/url_test.go @@ -9,7 +9,7 @@ import ( "github.com/stretchr/testify/assert" ) -func TestStripUrl(t *testing.T) { +func TestStripURL(t *testing.T) { cases := []struct { name string in string @@ -54,7 +54,7 @@ func TestStripUrl(t *testing.T) { } for _, c := range cases { t.Run(c.name, func(t *testing.T) { - assert.Equal(t, c.want, StripUrl(c.in)) + assert.Equal(t, c.want, StripURL(c.in)) }) } } diff --git a/routers/web/auth/oauth.go b/routers/web/auth/oauth.go index 1432662d77..d6b2ba4275 100644 --- a/routers/web/auth/oauth.go +++ b/routers/web/auth/oauth.go @@ -308,7 +308,7 @@ func oauth2UpdateAvatarIfNeed(ctx *context.Context, rawURL string, u *user_model } // Compute a redacted URL for log lines BEFORE issuing the request, so we // never accidentally log signed-URL query parameters or userinfo. - logURL := util.StripUrl(rawURL) + logURL := util.StripURL(rawURL) // Bind the outbound fetch to the inbound request context so the download // is cancelled if the user navigates away / aborts login, and so any