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:

committed by
Juan Batiz-Benet

parent
fecb434ab4
commit
83cda2e699
@ -61,17 +61,18 @@ func Parse(r *http.Request, root *cmds.Command) (cmds.Request, error) {
|
|||||||
if valCount <= lenRequired && !argDef.Required {
|
if valCount <= lenRequired && !argDef.Required {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
valCount--
|
|
||||||
|
|
||||||
if argDef.Type == cmds.ArgString {
|
if argDef.Type == cmds.ArgString {
|
||||||
if argDef.Variadic {
|
if argDef.Variadic {
|
||||||
for _, s := range stringArgs {
|
for _, s := range stringArgs {
|
||||||
args = append(args, s)
|
args = append(args, s)
|
||||||
}
|
}
|
||||||
|
valCount -= len(stringArgs)
|
||||||
|
|
||||||
} else if len(stringArgs) > 0 {
|
} else if len(stringArgs) > 0 {
|
||||||
args = append(args, stringArgs[0])
|
args = append(args, stringArgs[0])
|
||||||
stringArgs = stringArgs[1:]
|
stringArgs = stringArgs[1:]
|
||||||
|
valCount--
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
break
|
break
|
||||||
|
Reference in New Issue
Block a user