fix: bump upload limit to 11MB, add .gitignore for build artifacts
This commit is contained in:
parent
949d4f277c
commit
2f2fbf7630
3 changed files with 4 additions and 2 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -30,3 +30,5 @@ expenseflow-*
|
|||
|
||||
# Go
|
||||
vendor/
|
||||
.go/
|
||||
app
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ func NewExpenseHandler(db *sql.DB) *ExpenseHandler {
|
|||
// 5. Render templates/receipt_form.html with pre-filled fields or error banner
|
||||
func (h *ExpenseHandler) UploadReceipt(w http.ResponseWriter, r *http.Request) {
|
||||
// 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",
|
||||
time.Now().Format(time.RFC3339), err)
|
||||
renderUploadError(w, "Failed to parse upload form.")
|
||||
|
|
|
|||
2
main.go
2
main.go
|
|
@ -127,7 +127,7 @@ func main() {
|
|||
// Request body size limit (10 MB) on all endpoints.
|
||||
r.Use(func(next http.Handler) http.Handler {
|
||||
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)
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in a new issue