* fix: sanitize document filenames and add server-side upload validation
Filenames with spaces or non-ASCII characters (e.g. Swedish ö, ä, å) caused
Supabase Storage to reject uploads with "Invalid key". This adds filename
sanitization, server-side size/type validation on both upload routes, and
fixes a duplicate-filename race condition in the upload UI.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: require MIME type and handle empty sanitized filenames
Address review feedback:
- MIME type check now rejects files with missing/empty Content-Type
instead of silently allowing them through
- Fallback to 'file' when sanitized base is empty (e.g. ööö.pdf)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>