mirror of
https://github.com/go-gitea/gitea.git
synced 2025-12-17 22:09:30 +01:00
fix nilnil in onedev downloader (#36154)
onedev migration never used the migration transport, it now uses it the same way gogs one does --- cuts 3 nilnils for https://github.com/go-gitea/gitea/issues/36152
This commit is contained in:
parent
822ee60bae
commit
3bb0770160
@ -233,7 +233,7 @@ func TestAddLdapBindDn(t *testing.T) {
|
|||||||
},
|
},
|
||||||
getAuthSourceByID: func(ctx context.Context, id int64) (*auth.Source, error) {
|
getAuthSourceByID: func(ctx context.Context, id int64) (*auth.Source, error) {
|
||||||
assert.FailNow(t, "getAuthSourceByID called", "case %d: should not call getAuthSourceByID", n)
|
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
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -463,7 +463,7 @@ func TestAddLdapSimpleAuth(t *testing.T) {
|
|||||||
},
|
},
|
||||||
getAuthSourceByID: func(ctx context.Context, id int64) (*auth.Source, error) {
|
getAuthSourceByID: func(ctx context.Context, id int64) (*auth.Source, error) {
|
||||||
assert.FailNow(t, "getAuthSourceById called", "case %d: should not call getAuthSourceByID", n)
|
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
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -77,19 +77,19 @@ type OneDevDownloader struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewOneDevDownloader creates a new downloader
|
// 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{
|
downloader := &OneDevDownloader{
|
||||||
baseURL: baseURL,
|
baseURL: baseURL,
|
||||||
repoPath: repoPath,
|
repoPath: repoPath,
|
||||||
client: &http.Client{
|
client: &http.Client{
|
||||||
Transport: &http.Transport{
|
Transport: roundTripperFunc(
|
||||||
Proxy: func(req *http.Request) (*url.URL, error) {
|
func(req *http.Request) (*http.Response, error) {
|
||||||
if len(username) > 0 && len(password) > 0 {
|
if username != "" && password != "" {
|
||||||
req.SetBasicAuth(username, password)
|
req.SetBasicAuth(username, password)
|
||||||
}
|
}
|
||||||
return nil, nil
|
return httpTransport.RoundTrip(req.WithContext(ctx))
|
||||||
},
|
}),
|
||||||
},
|
|
||||||
},
|
},
|
||||||
userMap: make(map[int64]*onedevUser),
|
userMap: make(map[int64]*onedevUser),
|
||||||
milestoneMap: make(map[int64]string),
|
milestoneMap: make(map[int64]string),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user