1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-07-04 05:16:23 +08:00

commands/http: Fixed bug with client arg querystring

This commit is contained in:
Matt Bell
2014-12-01 23:42:14 -08:00
committed by Brian Tiger Chow
parent 4c7a694409
commit 5cb39235cc

View File

@ -107,15 +107,21 @@ func getQuery(req cmds.Request) (string, error) {
args := req.Arguments() args := req.Arguments()
argDefs := req.Command().Arguments argDefs := req.Command().Arguments
var argDef cmds.Argument
for i, arg := range args { argDefIndex := 0
if i < len(argDefs) {
argDef = argDefs[i] 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++
} }
} }