Skip to content

Commit f761799

Browse files
Ignore EOF error when parsing form.
1 parent 204ef41 commit f761799

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

modules/middleware/context.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,8 +369,8 @@ func InitContext() martini.Handler {
369369
}
370370

371371
// If request sends files, parse them here otherwise the Query() can't be parsed and the CsrfToken will be invalid.
372-
if strings.Contains(r.Header.Get("Content-Type"), "multipart/form-data") {
373-
if err = ctx.Req.ParseMultipartForm(setting.AttachmentMaxSize << 20); err != nil { // 32MB max size
372+
if r.Method == "POST" && strings.Contains(r.Header.Get("Content-Type"), "multipart/form-data") {
373+
if err = ctx.Req.ParseMultipartForm(setting.AttachmentMaxSize << 20); err != nil && !strings.Contains(err.Error(), "EOF") { // 32MB max size
374374
ctx.Handle(500, "issue.Comment(ctx.Req.ParseMultipartForm)", err)
375375
return
376376
}

0 commit comments

Comments
 (0)