fix: bump upload limit to 11MB, add .gitignore for build artifacts

This commit is contained in:
Claus Lohmar 2026-07-14 10:40:49 +00:00
parent 949d4f277c
commit 2f2fbf7630
3 changed files with 4 additions and 2 deletions

2
.gitignore vendored
View file

@ -30,3 +30,5 @@ expenseflow-*
# Go # Go
vendor/ vendor/
.go/
app

View file

@ -61,7 +61,7 @@ func NewExpenseHandler(db *sql.DB) *ExpenseHandler {
// 5. Render templates/receipt_form.html with pre-filled fields or error banner // 5. Render templates/receipt_form.html with pre-filled fields or error banner
func (h *ExpenseHandler) UploadReceipt(w http.ResponseWriter, r *http.Request) { func (h *ExpenseHandler) UploadReceipt(w http.ResponseWriter, r *http.Request) {
// 1. Parse multipart form with 10 MB max memory. // 1. Parse multipart form with 10 MB max memory.
if err := r.ParseMultipartForm(10 << 20); err != nil { if err := r.ParseMultipartForm(11 << 20); err != nil {
log.Printf("ERROR [%s] handlers: UploadReceipt: parse form: %v", log.Printf("ERROR [%s] handlers: UploadReceipt: parse form: %v",
time.Now().Format(time.RFC3339), err) time.Now().Format(time.RFC3339), err)
renderUploadError(w, "Failed to parse upload form.") renderUploadError(w, "Failed to parse upload form.")

View file

@ -127,7 +127,7 @@ func main() {
// Request body size limit (10 MB) on all endpoints. // Request body size limit (10 MB) on all endpoints.
r.Use(func(next http.Handler) http.Handler { r.Use(func(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
r.Body = http.MaxBytesReader(w, r.Body, 10<<20) r.Body = http.MaxBytesReader(w, r.Body, 11<<20)
next.ServeHTTP(w, r) next.ServeHTTP(w, r)
}) })
}) })