Skip to content

feat: show received file transfers as tappable attachments - #1692

Open
Chessing234 wants to merge 3 commits into
permissionlesstech:mainfrom
Chessing234:feat/tappable-file-attachments
Open

feat: show received file transfers as tappable attachments#1692
Chessing234 wants to merge 3 commits into
permissionlesstech:mainfrom
Chessing234:feat/tappable-file-attachments

Conversation

@Chessing234

@Chessing234 Chessing234 commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Summary

  • The transfer path already accepts PDFs and other files and stores them under files/incoming, but mediaAttachment only returned .voice / .image, so [file] notes.pdf rendered as ordinary chat text with no way to open it.
  • Resolve the [file] prefix the same way as the others and render a share / cancel / delete row. Reuses existing media.image.* strings — no new catalog keys.

Test plan

  • swiftc typecheck of BitchatMessage+Media.swift under Swift 5
  • swiftc typecheck of FileAttachmentView.swift under Swift 5 and 6
  • xcodebuild test suite — this machine has Command Line Tools only, no Xcode; CI covers BitchatMessageMediaTests and the view wiring
  • receive a PDF over mesh and share it from the timeline

The wire already stores PDFs and other files under files/incoming, but
the timeline only rendered [voice] and [image], so [file] notes.pdf
was plain text with no way to open or share it.
Cover that a file transfer is not classified as an image attachment.

@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: c1e19a097f

ℹ️ 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".

Comment on lines +61 to +62
if let url = url(for: .file) {
return .file(url)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Reject traversal names before creating file attachments

A peer can send an ordinary text message such as [file] ../../../prekeys/bundles.json: ChatTransportEventCoordinator constructs messages directly from untrusted packet.content, while this helper appends that unsanitized suffix to files/files/incoming. The new .file branch turns that resolved path into FileAttachmentView, whose ShareLink can export the resulting file outside the media directories (including Application Support data) when the recipient taps it. Normalize to a basename and verify the standardized URL remains under the selected media directory before returning .file.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

basename only now, same as cleanup. traversal names never become an attachment.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

A spoofed text bubble can carry [file] ../prekeys/… and ShareLink
would export the resolved path. Real transfers already store a
basename; require that and keep the URL inside the media directory.
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