Skip to content

Commit 53b500d

Browse files
committed
finaly fix #13535
1 parent 6626a04 commit 53b500d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

modules/migrations/gitlab.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,17 @@ func NewGitlabDownloader(ctx context.Context, baseURL, repoPath, username, passw
9090

9191
// split namespace and subdirectory
9292
pathParts := strings.Split(strings.Trim(repoPath, "/"), "/")
93+
var resp *gitlab.Response
94+
u, _ := url.Parse(baseURL)
9395
for len(pathParts) > 2 {
94-
if _, _, err = gitlabClient.Version.GetVersion(); err == nil {
96+
_, resp, err = gitlabClient.Version.GetVersion()
97+
if err == nil || resp != nil && resp.StatusCode == 401 {
98+
err = nil // if no authentication given, this still should work
9599
break
96100
}
97101

98-
baseURL = path.Join(baseURL, pathParts[0])
102+
u.Path = path.Join(u.Path, pathParts[0])
103+
baseURL = u.String()
99104
pathParts = pathParts[1:]
100105
_ = gitlab.WithBaseURL(baseURL)(gitlabClient)
101106
repoPath = strings.Join(pathParts, "/")

0 commit comments

Comments
 (0)