mirror of
https://github.com/ipfs/kubo.git
synced 2026-03-10 18:57:57 +08:00
commands: Fixed Request#CheckArguments not erroring when required arguments were missing
This commit is contained in:
parent
405cfd9762
commit
586a019fbf
@ -107,7 +107,19 @@ var converters = map[reflect.Kind]converter{
|
||||
func (r *request) CheckArguments(args []Argument) error {
|
||||
var argDef Argument
|
||||
|
||||
for i, arg := range r.arguments {
|
||||
var length int
|
||||
if len(r.arguments) > len(args) {
|
||||
length = len(r.arguments)
|
||||
} else {
|
||||
length = len(args)
|
||||
}
|
||||
|
||||
for i := 0; i < length; i++ {
|
||||
var arg interface{}
|
||||
if len(r.arguments) > i {
|
||||
arg = r.arguments[i]
|
||||
}
|
||||
|
||||
if i < len(args) {
|
||||
argDef = args[i]
|
||||
} else if !argDef.Variadic {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user