Files
sim/apps
WaleedandClaude Opus 4.7 773720ec7f fix(uploads): allow images/video/audio in mothership presigned route (#4534)
* fix(uploads): allow image/video/audio attachments in mothership presigned route

The mothership branch of the presigned upload route called validateFileType,
which only permits SUPPORTED_DOCUMENT_EXTENSIONS — rejecting PNG screenshots
and other media users have always been able to attach via the legacy
/api/files/upload mothership branch. Introduce validateAttachmentFileType,
backed by the union of document, code, image, audio, and video extensions,
and wire it into the mothership branch.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* fix(uploads): allow non-document execution outputs in presigned route

The execution branch of the presigned upload route called validateFileType,
which only permits documents — but workflow execution outputs are arbitrary
by design (images, audio, video, code). The legacy /api/files/upload
execution branch had no docs-only gate, so the staging refactor to
presigned PUTs regressed parity. Switch execution to validateAttachmentFileType
to match prior behavior.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* test(uploads): add coverage for attachment validator and dedupe extensions

- Dedupe SUPPORTED_ATTACHMENT_EXTENSIONS (webm appears in both audio
  and video lists)
- Reuse SUPPORTED_ATTACHMENT_EXTENSIONS in /api/files/upload to avoid
  drift with the presigned route
- Add unit tests for validateAttachmentFileType
- Add presigned route tests covering mothership/execution/knowledge-base
  validator selection and permission gating

* fix(uploads): restore SUPPORTED_IMAGE_EXTENSIONS import in upload route

Build broke because biome auto-fix collapsed my multi-import edit and
dropped SUPPORTED_IMAGE_EXTENSIONS, which is still referenced for the
generic-MIME image fallback at line 298.

---------

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-09 10:36:57 -07:00
..