mirror of
https://github.com/ipfs/kubo.git
synced 2026-03-07 01:08:08 +08:00
commands/http: Cleaned up argument handling in Parse
This commit is contained in:
parent
db9c7f7c29
commit
1b9b60331f
@ -45,9 +45,17 @@ func Parse(r *http.Request, root *cmds.Command) (cmds.Request, error) {
|
||||
|
||||
for _, arg := range cmd.Arguments {
|
||||
if arg.Type == cmds.ArgString {
|
||||
for j := 0; len(stringArgs) > 0 && arg.Variadic || j == 0; j++ {
|
||||
if arg.Variadic {
|
||||
for _, s := range stringArgs {
|
||||
args = append(args, s)
|
||||
}
|
||||
|
||||
} else if len(stringArgs) > 0 {
|
||||
args = append(args, stringArgs[0])
|
||||
stringArgs = stringArgs[1:]
|
||||
|
||||
} else {
|
||||
break
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user