Make Golang correctly delete temp files during uploading (#36128) (#36129)

Fix #36127

Partially backport #36128
And by the way partially backport  #36017
This commit is contained in:
wxiaoguang
2025-12-12 03:10:59 +08:00
committed by GitHub
parent e98d9bb93e
commit 3d66e75a47
7 changed files with 55 additions and 13 deletions

View File

@@ -43,8 +43,10 @@ type Base struct {
Locale translation.Locale
}
var ParseMultipartFormMaxMemory = int64(32 << 20)
func (b *Base) ParseMultipartForm() bool {
err := b.Req.ParseMultipartForm(32 << 20)
err := b.Req.ParseMultipartForm(ParseMultipartFormMaxMemory)
if err != nil {
// TODO: all errors caused by client side should be ignored (connection closed).
if !errors.Is(err, io.EOF) && !errors.Is(err, io.ErrUnexpectedEOF) {