Fix anonymous GL migration (#12862)
* Fix anonymous GL migration Signed-off-by: jolheiser <john.olheiser@gmail.com> * Rely on password instead Signed-off-by: jolheiser <john.olheiser@gmail.com> Co-authored-by: zeripath <art27@cantab.net>
This commit is contained in:
parent
0d14c2fb93
commit
d9085fe176
1 changed files with 4 additions and 3 deletions
|
@ -76,9 +76,10 @@ type GitlabDownloader struct {
|
||||||
func NewGitlabDownloader(ctx context.Context, baseURL, repoPath, username, password, token string) (*GitlabDownloader, error) {
|
func NewGitlabDownloader(ctx context.Context, baseURL, repoPath, username, password, token string) (*GitlabDownloader, error) {
|
||||||
var gitlabClient *gitlab.Client
|
var gitlabClient *gitlab.Client
|
||||||
var err error
|
var err error
|
||||||
if token != "" {
|
gitlabClient, err = gitlab.NewClient(token, gitlab.WithBaseURL(baseURL))
|
||||||
gitlabClient, err = gitlab.NewClient(token, gitlab.WithBaseURL(baseURL))
|
// Only use basic auth if token is blank and password is NOT
|
||||||
} else {
|
// Basic auth will fail with empty strings, but empty token will allow anonymous public API usage
|
||||||
|
if token == "" && password != "" {
|
||||||
gitlabClient, err = gitlab.NewBasicAuthClient(username, password, gitlab.WithBaseURL(baseURL))
|
gitlabClient, err = gitlab.NewBasicAuthClient(username, password, gitlab.WithBaseURL(baseURL))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue