mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-23 19:37:46 +08:00
commands: Fixed parser argument bug (TODO: better test coverage for command parsers)
This commit is contained in:
parent
b6aad53d86
commit
cb72868ab4
@ -132,6 +132,8 @@ func parseArgs(stringArgs []string, cmd *cmds.Command) ([]interface{}, error) {
|
||||
// skip optional argument definitions if there aren't sufficient remaining values
|
||||
if len(stringArgs)-j <= lenRequired && !argDef.Required {
|
||||
continue
|
||||
} else if argDef.Required {
|
||||
lenRequired--
|
||||
}
|
||||
|
||||
if j >= len(stringArgs) {
|
||||
|
||||
@ -60,6 +60,8 @@ func Parse(r *http.Request, root *cmds.Command) (cmds.Request, error) {
|
||||
// skip optional argument definitions if there aren't sufficient remaining values
|
||||
if valCount <= lenRequired && !argDef.Required {
|
||||
continue
|
||||
} else if argDef.Required {
|
||||
lenRequired--
|
||||
}
|
||||
|
||||
if argDef.Type == cmds.ArgString {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user