1
0
Fork 0
forked from forgejo/forgejo

Fix cli command restore-repo: "units" should be parsed as cli.String (#20183) (#20187)

This commit is contained in:
wxiaoguang 2022-07-01 23:16:59 +08:00 committed by GitHub
parent 3e4fe009e7
commit bf43db10a9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 7 deletions

View file

@ -128,7 +128,9 @@ func runDumpRepository(ctx *cli.Context) error {
} else {
units := strings.Split(ctx.String("units"), ",")
for _, unit := range units {
switch strings.ToLower(unit) {
switch strings.ToLower(strings.TrimSpace(unit)) {
case "":
continue
case "wiki":
opts.Wiki = true
case "issues":
@ -145,6 +147,8 @@ func runDumpRepository(ctx *cli.Context) error {
opts.Comments = true
case "pull_requests":
opts.PullRequests = true
default:
return errors.New("invalid unit: " + unit)
}
}
}