mirror of
				https://github.com/go-gitea/gitea
				synced 2025-10-31 11:28:24 +00:00 
			
		
		
		
	fix attachment file size limit in server backend (#35519)
fix #35512 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
		| @@ -4,6 +4,7 @@ | ||||
| package context | ||||
|  | ||||
| import ( | ||||
| 	"errors" | ||||
| 	"fmt" | ||||
| 	"html/template" | ||||
| 	"io" | ||||
| @@ -42,6 +43,20 @@ type Base struct { | ||||
| 	Locale translation.Locale | ||||
| } | ||||
|  | ||||
| func (b *Base) ParseMultipartForm() bool { | ||||
| 	err := b.Req.ParseMultipartForm(32 << 20) | ||||
| 	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) { | ||||
| 			// Errors caused by server side (disk full) should be logged. | ||||
| 			log.Error("Failed to parse request multipart form for %s: %v", b.Req.RequestURI, err) | ||||
| 		} | ||||
| 		b.HTTPError(http.StatusInternalServerError, "failed to parse request multipart form") | ||||
| 		return false | ||||
| 	} | ||||
| 	return true | ||||
| } | ||||
|  | ||||
| // AppendAccessControlExposeHeaders append headers by name to "Access-Control-Expose-Headers" header | ||||
| func (b *Base) AppendAccessControlExposeHeaders(names ...string) { | ||||
| 	val := b.RespHeader().Get("Access-Control-Expose-Headers") | ||||
|   | ||||
		Reference in New Issue
	
	Block a user