@@ -33,10 +33,14 @@ func (f *GitBucketDownloaderFactory) New(ctx context.Context, opts base.MigrateO
3333 return nil , err
3434 }
3535
36- baseURL := u .Scheme + "://" + u .Host
3736 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" )
4044
4145 log .Trace ("Create GitBucket downloader. BaseURL: %s RepoOwner: %s RepoName: %s" , baseURL , oldOwner , oldName )
4246 return NewGitBucketDownloader (ctx , baseURL , opts .AuthUsername , opts .AuthPassword , opts .AuthToken , oldOwner , oldName ), nil
@@ -71,6 +75,7 @@ func (g *GitBucketDownloader) ColorFormat(s fmt.State) {
7175func NewGitBucketDownloader (ctx context.Context , baseURL , userName , password , token , repoOwner , repoName string ) * GitBucketDownloader {
7276 githubDownloader := NewGithubDownloaderV3 (ctx , baseURL , userName , password , token , repoOwner , repoName )
7377 githubDownloader .SkipReactions = true
78+ githubDownloader .SkipReviews = true
7479 return & GitBucketDownloader {
7580 githubDownloader ,
7681 }
0 commit comments