mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-29 17:36:38 +08:00
commands/http: s/lenRequired/numRequired/
This commit is contained in:

committed by
Juan Batiz-Benet

parent
50751617b6
commit
f93b806d21
@ -42,10 +42,10 @@ func Parse(r *http.Request, root *cmds.Command) (cmds.Request, error) {
|
|||||||
args := make([]interface{}, 0)
|
args := make([]interface{}, 0)
|
||||||
|
|
||||||
// count required argument definitions
|
// count required argument definitions
|
||||||
lenRequired := 0
|
numRequired := 0
|
||||||
for _, argDef := range cmd.Arguments {
|
for _, argDef := range cmd.Arguments {
|
||||||
if argDef.Required {
|
if argDef.Required {
|
||||||
lenRequired++
|
numRequired++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,10 +58,10 @@ func Parse(r *http.Request, root *cmds.Command) (cmds.Request, error) {
|
|||||||
|
|
||||||
for _, argDef := range cmd.Arguments {
|
for _, argDef := range cmd.Arguments {
|
||||||
// skip optional argument definitions if there aren't sufficient remaining values
|
// skip optional argument definitions if there aren't sufficient remaining values
|
||||||
if valCount <= lenRequired && !argDef.Required {
|
if valCount <= numRequired && !argDef.Required {
|
||||||
continue
|
continue
|
||||||
} else if argDef.Required {
|
} else if argDef.Required {
|
||||||
lenRequired--
|
numRequired--
|
||||||
}
|
}
|
||||||
|
|
||||||
if argDef.Type == cmds.ArgString {
|
if argDef.Type == cmds.ArgString {
|
||||||
|
Reference in New Issue
Block a user