mirror of
https://github.com/ipfs/kubo.git
synced 2025-07-02 03:28:25 +08:00
commands/http: Fixed bug with client arg querystring
This commit is contained in:

committed by
Brian Tiger Chow

parent
4c7a694409
commit
5cb39235cc
@ -107,15 +107,21 @@ func getQuery(req cmds.Request) (string, error) {
|
||||
|
||||
args := req.Arguments()
|
||||
argDefs := req.Command().Arguments
|
||||
var argDef cmds.Argument
|
||||
|
||||
for i, arg := range args {
|
||||
if i < len(argDefs) {
|
||||
argDef = argDefs[i]
|
||||
argDefIndex := 0
|
||||
|
||||
for _, arg := range args {
|
||||
argDef := argDefs[argDefIndex]
|
||||
// skip ArgFiles
|
||||
for argDef.Type == cmds.ArgFile {
|
||||
argDefIndex++
|
||||
argDef = argDefs[argDefIndex]
|
||||
}
|
||||
|
||||
if argDef.Type == cmds.ArgString {
|
||||
query.Add("arg", arg)
|
||||
query.Add("arg", arg)
|
||||
|
||||
if len(argDefs) > argDefIndex+1 {
|
||||
argDefIndex++
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user