Skip to content

feat(cli): allow generic file uploads including zip - #4880

Open
Trevongit wants to merge 2 commits into
block:mainfrom
Trevongit:feat/cli-m1-generic-file-upload
Open

feat(cli): allow generic file uploads including zip#4880
Trevongit wants to merge 2 commits into
block:mainfrom
Trevongit:feat/cli-m1-generic-file-upload

Conversation

@Trevongit

Copy link
Copy Markdown

Summary

  • Widen buzz-cli upload MIME policy so agent co-lab can attach zip skill packs and other safe generic files (pdf, text, json, common archives/docs).
  • Keep a danger denylist aligned with buzz-media (HTML/JS/SVG, native executables/installers); images and video/mp4 unchanged.
  • Generic uploads use a 100 MB cap (matches relay default BUZZ_MAX_FILE_BYTES).

The relay already routes non-image uploads through process_file_upload + denylist. The CLI was the choke (unsupported file type: application/zip).

Dogfood

  • Unit tests for allow/block/size tiers
  • Live zip upload to a private My Groundfeed via rebuilt CLI succeeded

Test plan

  • cargo test -p buzz-cli --lib upload_
  • CI full suite
  • Optional: buzz upload file --file pack.zip against a local or private relay

Agent co-lab was blocked on skill packs because buzz-cli only allowed
image/* and video/mp4. The relay already accepts generic Blossom uploads
via a danger denylist (HTML/JS/SVG/executables). Align the CLI with that
policy so zip/pdf/text and similar types work while unsafe types stay
blocked.

Add unit coverage for allow/block and size tiers (100MB generic).

Signed-off-by: Trevor P <trev2005@gmail.com>
@Trevongit
Trevongit requested a review from a team as a code owner August 5, 2026 11:50

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1562cc9cda

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

if mime.starts_with("audio/") {
return false;
}
!BLOCKED_FILE_MIMES.contains(&mime)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Render generic attachments as links

Allowing every non-blocklisted MIME here also enables buzz messages send --file <pdf|zip|txt>, but that send path still formats every uploaded non-video descriptor as ![image](url) in crates/buzz-cli/src/commands/messages.rs:622-626. Desktop's generic file renderer keys on a plain [filename](url) link with matching non-media imeta, so these newly allowed attachments render as broken inline images instead of download cards; update the CLI message formatting before broadening this allowlist.

Useful? React with 👍 / 👎.

@michegz

michegz commented Aug 5, 2026

Copy link
Copy Markdown

Independent prod verification, in case it's useful for review — I hit the exact unsupported file type: application/pdf this patches against a live communities.buzz.xyz deployment (buzz upload file --file cattle.pdf on a 180 KB, 7-page document). To sanity-check the fallback story this PR relies on, I bypassed the CLI and signed a Blossom kind:24242 event directly to PUT /upload: returns 200 OK with "type":"application/pdf", and buzz media get round-trips byte-identical (SHA-256 match). So the server-side `validate_file_content` + `BLOCKED_FILE_MIME_TYPES` filter this PR trusts is doing its job in production — the CLI's `ALLOWED_MIMES` really is the sole choke on communities.buzz.xyz today.

One thing I liked reviewing the diff: `is_upload_mime_allowed()` mirrors the relay's denylist rather than hand-rolling a parallel allowlist, so the CLI won't silently drift out of sync the next time `buzz-media` adds a MIME. That's a nicer factoring than a static list would have been.

Trevongit added a commit to Trevongit/buzz that referenced this pull request Aug 6, 2026
Codex P2 on block#4880: after widening upload MIME types, `messages send --file`
still emitted `![image](url)` for every non-video blob. Desktop FileCard
expects plain `[filename](url)` plus imeta `filename` for zip/pdf/txt.

Match Desktop formatImetaMediaLine: images/video stay inline; generic files
and agent/team snapshot PNGs use markdown links; escape label metacharacters;
include basename on imeta tags.

Signed-off-by: Trevor P <trev2005@gmail.com>
Codex P2 on block#4880: after widening upload MIME types, `messages send --file`
still emitted `![image](url)` for every non-video blob. Desktop FileCard
expects plain `[filename](url)` plus imeta `filename` for zip/pdf/txt.

Match Desktop formatImetaMediaLine: images/video stay inline; generic files
and agent/team snapshot PNGs use markdown links; escape label metacharacters;
include basename on imeta tags.

Signed-off-by: Trevor P <trev2005@gmail.com>
@Trevongit
Trevongit force-pushed the feat/cli-m1-generic-file-upload branch from 1d36957 to 5fb4c1a Compare August 6, 2026 14:37
@Trevongit

Copy link
Copy Markdown
Author

Addressed the Codex P2 (generic attachments as links):

  • messages send --file now formats via format_attachment_markdown (Desktop formatImetaMediaLine parity):
    • image/*![image](url) (except *.agent.png / *.team.png snapshots → file link)
    • video/*![video](url)
    • generic (zip/pdf/txt/…) → [filename](url) with label escaping
  • imeta tags now include filename <basename> for FileCard labels

Pushed on this PR as fix(cli): format generic file attachments as download links.

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.

2 participants