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]>
Adds a new POST /admin/upload-file endpoint for uploading any file type
alongside the existing image upload. Files are served with
Content-Disposition: attachment to prevent same-origin XSS via uploaded
HTML/SVG/JS. The display filename embedded in markdown link responses is
sanitized to block markdown injection.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
The JS QR library (qr.min.js) produced unscannable codes. Replaced with
a /admin/qr/{slug} endpoint using the same server-side rsc.io/qr that
already works on the home page.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Rebrand from "urlshort" to "Glimmer" across the entire codebase:
Go module/imports, build targets, HTML templates, deploy scripts
(including renaming service files), config, and README.
Co-Authored-By: Claude Opus 4.6 <[email protected]>