From 81f4fc4d51e23d1f12a0b2c2a953bfe0a374b61f Mon Sep 17 00:00:00 2001 From: TheFox0x7 Date: Sat, 13 Dec 2025 18:29:11 +0100 Subject: [PATCH 1/3] fix nilnil in oneDev downloader Applies the same override as with gogs downloader --- services/migrations/onedev.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/services/migrations/onedev.go b/services/migrations/onedev.go index 9917bdae3c1a0..a30e36c8b8318 100644 --- a/services/migrations/onedev.go +++ b/services/migrations/onedev.go @@ -77,19 +77,19 @@ type OneDevDownloader struct { } // NewOneDevDownloader creates a new downloader -func NewOneDevDownloader(_ context.Context, baseURL *url.URL, username, password, repoPath string) *OneDevDownloader { +func NewOneDevDownloader(ctx context.Context, baseURL *url.URL, username, password, repoPath string) *OneDevDownloader { + httpTransport := NewMigrationHTTPTransport() downloader := &OneDevDownloader{ baseURL: baseURL, repoPath: repoPath, client: &http.Client{ - Transport: &http.Transport{ - Proxy: func(req *http.Request) (*url.URL, error) { - if len(username) > 0 && len(password) > 0 { + Transport: roundTripperFunc( + func(req *http.Request) (*http.Response, error) { + if username != "" && password != "" { req.SetBasicAuth(username, password) } - return nil, nil - }, - }, + return httpTransport.RoundTrip(req.WithContext(ctx)) + }), }, userMap: make(map[int64]*onedevUser), milestoneMap: make(map[int64]string), From e0eb6f63cb663cce2800119de5f04bdda3de2c04 Mon Sep 17 00:00:00 2001 From: TheFox0x7 Date: Sat, 13 Dec 2025 21:56:35 +0100 Subject: [PATCH 2/3] ignore nilnil in cmd tests --- cmd/admin_auth_ldap_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/admin_auth_ldap_test.go b/cmd/admin_auth_ldap_test.go index 2da7ebc573b3b..b800a7890bcec 100644 --- a/cmd/admin_auth_ldap_test.go +++ b/cmd/admin_auth_ldap_test.go @@ -233,7 +233,7 @@ func TestAddLdapBindDn(t *testing.T) { }, getAuthSourceByID: func(ctx context.Context, id int64) (*auth.Source, error) { assert.FailNow(t, "getAuthSourceByID called", "case %d: should not call getAuthSourceByID", n) - return nil, nil + return nil, nil //nolint:nilnil // mock function covering improper behavior }, } From f1cc93d41e60c04b1613c99c84931414b0632e16 Mon Sep 17 00:00:00 2001 From: TheFox0x7 Date: Sat, 13 Dec 2025 22:13:37 +0100 Subject: [PATCH 3/3] ignore the other call --- cmd/admin_auth_ldap_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/admin_auth_ldap_test.go b/cmd/admin_auth_ldap_test.go index b800a7890bcec..0e3e465e81ea0 100644 --- a/cmd/admin_auth_ldap_test.go +++ b/cmd/admin_auth_ldap_test.go @@ -463,7 +463,7 @@ func TestAddLdapSimpleAuth(t *testing.T) { }, getAuthSourceByID: func(ctx context.Context, id int64) (*auth.Source, error) { assert.FailNow(t, "getAuthSourceById called", "case %d: should not call getAuthSourceByID", n) - return nil, nil + return nil, nil //nolint:nilnil // mock function covering improper behavior }, }