Files
Glimmer/internal/server/static
lucioandClaude Opus 4.8 1be1e0c001 Fix large image uploads failing with bogus CSRF 403 + add client-side compression
The upload handlers called verifyCSRF (which reads a form value, implicitly
triggering ParseMultipartForm) before parsing the multipart body. When a file
exceeded the MaxBytesReader cap, the parse failed, FormValue returned "", and
the request was rejected as "Invalid CSRF token" (403) instead of a proper
413 "File too large". Small images parsed fine, so only large uploads broke.

- handlers.go: parse the multipart form explicitly before the CSRF check in
  both handleUpload and handleFileUpload; report oversized bodies as 413 via
  errors.As(http.MaxBytesError) instead of a fragile error-string compare.
- upload.js: offer in-browser canvas compression (downscale + JPEG re-encode)
  for images over 10 MB before upload; falls back to the original on failure.
- server.go: allow blob: in CSP img-src so the compressor canvas can load the
  selected file.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
2026-06-04 23:03:38 -07:00
..
2026-06-02 01:24:35 -07:00