@@ -34,10 +34,14 @@ func (f *GitBucketDownloaderFactory) New(ctx context.Context, opts base.MigrateO
3434 return nil , err
3535 }
3636
37- baseURL := u .Scheme + "://" + u .Host
3837 fields := strings .Split (u .Path , "/" )
39- oldOwner := fields [1 ]
40- oldName := strings .TrimSuffix (fields [2 ], ".git" )
38+ if len (fields ) < 2 {
39+ return nil , fmt .Errorf ("invalid path: %s" , u .Path )
40+ }
41+ baseURL := u .Scheme + "://" + u .Host + strings .TrimSuffix (strings .Join (fields [:len (fields )- 2 ], "/" ), "/git" )
42+
43+ oldOwner := fields [len (fields )- 2 ]
44+ oldName := strings .TrimSuffix (fields [len (fields )- 1 ], ".git" )
4145
4246 log .Trace ("Create GitBucket downloader. BaseURL: %s RepoOwner: %s RepoName: %s" , baseURL , oldOwner , oldName )
4347 return NewGitBucketDownloader (ctx , baseURL , opts .AuthUsername , opts .AuthPassword , opts .AuthToken , oldOwner , oldName ), nil
@@ -72,6 +76,7 @@ func (g *GitBucketDownloader) ColorFormat(s fmt.State) {
7276func NewGitBucketDownloader (ctx context.Context , baseURL , userName , password , token , repoOwner , repoName string ) * GitBucketDownloader {
7377 githubDownloader := NewGithubDownloaderV3 (ctx , baseURL , userName , password , token , repoOwner , repoName )
7478 githubDownloader .SkipReactions = true
79+ githubDownloader .SkipReviews = true
7580 return & GitBucketDownloader {
7681 githubDownloader ,
7782 }
0 commit comments