attempt to fix bug for post-form map when go version is 1.6

This commit is contained in:
thinkerou 2018-06-07 08:29:04 +08:00
parent 9e1cbfca1b
commit 51386de165

View File

@ -461,6 +461,17 @@ func (c *Context) GetPostFormMap(key string) (map[string]string, bool) {
}
}
}
if !exist && req.MultipartForm != nil && req.MultipartForm.File != nil {
for k, v := range req.MultipartForm.Value {
if i := strings.IndexByte(k, '['); i >= 1 && k[0:i] == key {
if j := strings.IndexByte(k[i+1:], ']'); j >= 1 {
exist = true
dicts[k[i+1:][:j]] = v[0]
}
}
}
}
return dicts, exist
}