Skip to content

[Mobile] Attachments: camera, photo library, and files - #27

Merged
wak327 merged 1 commit into
mobile-commentsfrom
mobile-attachments
Sep 11, 2026
Merged

wak327 merged 1 commit into
mobile-commentsfrom
mobile-attachments

Conversation

@wak327

@wak327 wak327 commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Closes #9.

Uploads bypass the generated client: Orval emits a Blob body, and React Native has no real Blob to give it — a picked file is a file:// URI the native layer streams itself, which is what {uri, name, type} in FormData expresses. That also gives a progress callback, which reading the file into memory first would not.

The server's allowed list is mirrored client-side so a phone refuses a file before spending a minute uploading it, and the SVG message says why — it is a document that can carry script, so a generic "not allowed" would read as an oversight rather than a decision.

Attachment bytes are authenticated, so images are fetched with the bearer token in a header rather than the query string, where it would end up in whatever logs the instance keeps. A plain image source would simply 401 — there is a test pinning exactly that.

Two corrections from checking rather than assuming

A disallowed extension is 415, not 400. A file whose bytes do not match its name is 422 with the server naming the format. Both now assert what the server actually does.

Closes #9.

Uploads bypass the generated client: Orval emits a Blob body, and React Native
has no real Blob to give it -- a picked file is a file:// URI the native layer
streams itself, which is what `{uri, name, type}` in FormData expresses. That
also gives a progress callback, which reading the file into memory first would
not.

The server's allowed list is mirrored client-side so a phone refuses a file
before spending a minute uploading something that was never going to land, and
the SVG message says *why* it is refused -- it is a document that can carry
script, so a generic "not allowed" would read as an oversight rather than a
decision.

Attachment bytes are authenticated, so images are fetched with the bearer token
in a header rather than the query string, where it would end up in whatever logs
the instance keeps. A plain image source would simply 401 -- there is a test
that pins exactly that.

Two corrections from checking rather than assuming: a disallowed extension is
415, and a file whose bytes do not match its name is 422 with the server naming
the format. Both now assert what the server actually does.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@wak327
wak327 merged commit f85b496 into mobile-comments Sep 11, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant