@@ -34,10 +34,14 @@ func (f *GitBucketDownloaderFactory) New(ctx context.Context, opts base.MigrateO
34
34
return nil , err
35
35
}
36
36
37
- baseURL := u .Scheme + "://" + u .Host
38
37
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" )
41
45
42
46
log .Trace ("Create GitBucket downloader. BaseURL: %s RepoOwner: %s RepoName: %s" , baseURL , oldOwner , oldName )
43
47
return NewGitBucketDownloader (ctx , baseURL , opts .AuthUsername , opts .AuthPassword , opts .AuthToken , oldOwner , oldName ), nil
@@ -72,6 +76,7 @@ func (g *GitBucketDownloader) ColorFormat(s fmt.State) {
72
76
func NewGitBucketDownloader (ctx context.Context , baseURL , userName , password , token , repoOwner , repoName string ) * GitBucketDownloader {
73
77
githubDownloader := NewGithubDownloaderV3 (ctx , baseURL , userName , password , token , repoOwner , repoName )
74
78
githubDownloader .SkipReactions = true
79
+ githubDownloader .SkipReviews = true
75
80
return & GitBucketDownloader {
76
81
githubDownloader ,
77
82
}
0 commit comments