@@ -33,10 +33,14 @@ func (f *GitBucketDownloaderFactory) New(ctx context.Context, opts base.MigrateO
33
33
return nil , err
34
34
}
35
35
36
- baseURL := u .Scheme + "://" + u .Host
37
36
fields := strings .Split (u .Path , "/" )
38
- oldOwner := fields [1 ]
39
- oldName := strings .TrimSuffix (fields [2 ], ".git" )
37
+ if len (fields ) < 2 {
38
+ return nil , fmt .Errorf ("invalid path: %s" , u .Path )
39
+ }
40
+ baseURL := u .Scheme + "://" + u .Host + strings .TrimSuffix (strings .Join (fields [:len (fields )- 2 ], "/" ), "/git" )
41
+
42
+ oldOwner := fields [len (fields )- 2 ]
43
+ oldName := strings .TrimSuffix (fields [len (fields )- 1 ], ".git" )
40
44
41
45
log .Trace ("Create GitBucket downloader. BaseURL: %s RepoOwner: %s RepoName: %s" , baseURL , oldOwner , oldName )
42
46
return NewGitBucketDownloader (ctx , baseURL , opts .AuthUsername , opts .AuthPassword , opts .AuthToken , oldOwner , oldName ), nil
@@ -71,6 +75,7 @@ func (g *GitBucketDownloader) ColorFormat(s fmt.State) {
71
75
func NewGitBucketDownloader (ctx context.Context , baseURL , userName , password , token , repoOwner , repoName string ) * GitBucketDownloader {
72
76
githubDownloader := NewGithubDownloaderV3 (ctx , baseURL , userName , password , token , repoOwner , repoName )
73
77
githubDownloader .SkipReactions = true
78
+ githubDownloader .SkipReviews = true
74
79
return & GitBucketDownloader {
75
80
githubDownloader ,
76
81
}
0 commit comments