1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-07-01 19:24:14 +08:00

commands/http: Fixed arg parse bug

This commit is contained in:
Matt Bell
2014-11-04 23:40:15 -08:00
committed by Juan Batiz-Benet
parent fecb434ab4
commit 83cda2e699

View File

@ -61,17 +61,18 @@ func Parse(r *http.Request, root *cmds.Command) (cmds.Request, error) {
if valCount <= lenRequired && !argDef.Required {
continue
}
valCount--
if argDef.Type == cmds.ArgString {
if argDef.Variadic {
for _, s := range stringArgs {
args = append(args, s)
}
valCount -= len(stringArgs)
} else if len(stringArgs) > 0 {
args = append(args, stringArgs[0])
stringArgs = stringArgs[1:]
valCount--
} else {
break