#281: /raw/{id} returns empty body for non-image attachment pastes (Fix attempt 1) #286

Merged
fen merged 1 commits from fix-281 into dev 2026-09-18 01:33:45 +00:00
Collaborator

Fix attempt 1. Ref #281.

handleRaw streamed the attachment blob only behind an isImageMime gate (#221), so non-image attachment pastes fell through to empty row.Content and /raw served 0 bytes. Now the blob streams for ALL attachment mimes, with the sniffed mime passed through serveContentType so active-content types (html, svg, xml) still serve as text/plain per the #34 stored-XSS rule.

  • Regression tests: text attachment via multipart create then GET /raw asserts 200, text/plain; charset=utf-8, nosniff, byte equality; html attachment asserts the forced text/plain Content-Type with original bytes.
  • go build + go test ./... pass.
  • Removed the now-unused isImageMime helper.
Fix attempt 1. Ref #281. handleRaw streamed the attachment blob only behind an isImageMime gate (#221), so non-image attachment pastes fell through to empty row.Content and /raw served 0 bytes. Now the blob streams for ALL attachment mimes, with the sniffed mime passed through serveContentType so active-content types (html, svg, xml) still serve as text/plain per the #34 stored-XSS rule. - Regression tests: text attachment via multipart create then GET /raw asserts 200, text/plain; charset=utf-8, nosniff, byte equality; html attachment asserts the forced text/plain Content-Type with original bytes. - go build + go test ./... pass. - Removed the now-unused isImageMime helper.
fen added 1 commit 2026-09-18 01:32:12 +00:00
#281: /raw streams attachment blob for all attachment mimes
CI / docker (pull_request) Skipped
CI / test (pull_request) Successful in 25s
8901a3c82c
handleRaw only streamed the blob behind an isImageMime gate (#221), so
non-image attachment pastes fell through to empty row.Content and /raw
served 0 bytes. Serve the blob for every attachment mime, passing the
sniffed mime through serveContentType so active-content types (html,
svg, xml) still serve as text/plain per the #34 rule. Regression tests
cover text and html attachments (size, Content-Type, byte equality).
fen merged commit c190dd9ea6 into dev 2026-09-18 01:33:45 +00:00
Sign in to join this conversation.