Skip to content

fix(cli): accept every file type the relay accepts on upload - #7581

Closed
trialismm wants to merge 1 commit into
block:mainfrom
trialismm:pr/cli-attach-any-file
Closed

trialismm wants to merge 1 commit into
block:mainfrom
trialismm:pr/cli-attach-any-file

Conversation

@trialismm

Copy link
Copy Markdown

Problem

buzz upload file and buzz messages send --file accept only jpeg, png, gif, webp
and mp4 (ALLOWED_MIMES in crates/buzz-cli/src/client.rs). The relay accepts much
more: buzz-media::validation refuses only active web content and native
executables, and stores anything without magic bytes as application/octet-stream
(its own test asserts plaintext is accepted that way).

The practical effect is that an agent cannot hand a document back to the people it
works with. Ask an agent for a written deliverable and it writes the file, then
cannot attach it:

$ buzz upload file --file plan_v2.md
{"error":"user_error","message":"unsupported file type: application/octet-stream","retryable":false}

We watched an agent try .md, copy it to .txt, then .json, and finally give up
and paste an 18 KB document into the message body.

Change

  • upload_mime_for() replaces the allow-list with the relay's deny-list (mirroring
    BLOCKED_FILE_MIME_TYPES): text, PDFs, archives and the rest upload, while
    executables and active web content are still refused client-side.
  • BlobDescriptor gains filename, set from the uploaded path, and
    build_imeta_tag emits filename <name> — the NIP-92 field the Desktop already
    writes and reads for generic attachments.
  • buzz messages send --file renders a non-image/video attachment as
    [name](url) instead of ![image](url), matching the Desktop.

buzz upload file now prints filename in its JSON descriptor when known
(omitted otherwise) — additive, existing parsers are unaffected.

Size caps are unchanged (50 MB, 500 MB for video); the constant's doc comment was
reworded because it is no longer image-only.

Tests

upload_mime_tests in client.rs: plaintext sniffs to application/octet-stream,
PNG magic bytes to image/png, a PE header is refused; the imeta tag carries the
filename and mime.

Manual test

buzz upload file --file notes.md
buzz messages send --channel <uuid> --file notes.md 'here you go'

The Desktop renders a named download link and the file opens.

Note

One line in crates/buzz-acp/src/base_prompt.md tells agents that --file exists —
without it they keep pasting documents into the message body, which is the behaviour
this fixes. Happy to split that out if you would rather keep the prompt separate.

🤖 Generated with Claude Code

buzz upload file and buzz messages send --file only accepted jpeg, png, gif, webp and mp4, while the relay refuses only active web content and native executables and stores un-sniffable files as application/octet-stream. An agent therefore could not attach a document it had written: .md, .txt and .json all failed with 'unsupported file type'.

Replace the allow-list with the relay's deny-list, carry the original file name into the imeta tag (NIP-92 filename, which the Desktop already writes and reads), and link non-media attachments as [name](url) instead of an image embed. One line in the ACP base prompt tells agents that --file exists.

Co-Authored-By: Claude Opus 5 <[email protected]>
Signed-off-by: trialismm <[email protected]>
@trialismm
trialismm requested a review from a team as a code owner September 11, 2026 14:56
@github-actions

Copy link
Copy Markdown

🔐 Codex Security Review

Status: review required for the current range.

The current range is 813bbd14121edacc6cb4733301a3af12131aa10e...460452eedf980bd398ae9969f21eb12aafcf8fbe.
A new review must complete for this exact range. When manual authorization
is required, a Block organization member must comment exactly
@buzz-security-review 460452eedf980bd398ae9969f21eb12aafcf8fbe to authorize a new review.
Any previous review applies only to its recorded range.

@trialismm

Copy link
Copy Markdown
Author

Closing this — I'm no longer maintaining my fork. Thanks for taking a look!

@trialismm trialismm closed this Oct 5, 2026
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