e307bd7b by astaxie

beego:hotfix for multipart/form-data

1 parent a99802b7
...@@ -264,20 +264,15 @@ func (input *BeegoInput) SetData(key, val interface{}) { ...@@ -264,20 +264,15 @@ func (input *BeegoInput) SetData(key, val interface{}) {
264 input.Data[key] = val 264 input.Data[key] = val
265 } 265 }
266 266
267 // parseForm or parseMultiForm based on Content-type
267 func (input *BeegoInput) ParseFormOrMulitForm(maxMemory int64) error { 268 func (input *BeegoInput) ParseFormOrMulitForm(maxMemory int64) error {
268 // Parse the body depending on the content type. 269 // Parse the body depending on the content type.
269 switch input.Header("Content-Type") { 270 if strings.Contains(input.Header("Content-Type"), "multipart/form-data") {
270 case "application/x-www-form-urlencoded":
271 // Typical form.
272 if err := input.Request.ParseForm(); err != nil {
273 return errors.New("Error parsing request body:" + err.Error())
274 }
275
276 case "multipart/form-data":
277 if err := input.Request.ParseMultipartForm(maxMemory); err != nil { 271 if err := input.Request.ParseMultipartForm(maxMemory); err != nil {
278 return errors.New("Error parsing request body:" + err.Error()) 272 return errors.New("Error parsing request body:" + err.Error())
279 } 273 }
274 } else if err := input.Request.ParseForm(); err != nil {
275 return errors.New("Error parsing request body:" + err.Error())
280 } 276 }
281
282 return nil 277 return nil
283 } 278 }
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!