Repository navigation
Description
Summary
In the bb iOS app, every web-app download link takes over or leaves the app instead of saving the file. On a normal (root-mounted) server, tapping Download in the file preview, or a Tasks attachment card, replaces the whole app with the file's raw bytes rendered as text. There is no back button or gesture; only force-quitting the app recovers. On a server added with a path prefix, the same tap opens Safari, which downloads the file without the app's cookies and under the wrong name. Expected: the file is offered for saving (share sheet / Save to Files) and the app stays where it was.
Versions and environment
- bb from source at
main522255c (bb --version0.46.0),pnpm start:worktree(production bundle served by the server) - bb iOS app 0.39.0, Debug dev client built from the same commit, iPhone 17 Pro Simulator, iOS 26.4 (23E244). Xcode 27.0 on macOS 26.6.2. The iOS 27 simulator can't launch the app at all (UIScene-adoption assert), which is unrelated to this issue.
- Direct server profile
http://127.0.0.1:21000(root mount) and a second profilehttp://127.0.0.1:21100/bbbehind a local prefix-stripping proxy (prefixed mount).
Steps to reproduce
printf 'hello download\n' > note.txt && zip sample.zip note.txtin a scratch git repo, thenbb project create --name dlfixture --root <repo>.bb plugin install builtin:tasks --yes,bb tasks project create --name "DL Fixture" --prefix DL,bb tasks create --project DL --title "Download repro" --attach <repo>/sample.zip.bb thread create --project <proj_id> --prompt "Reply with just OK." --file <repo>/sample.zip.- In the iOS app, add the server as a Direct profile.
- Open
bb://plugins/tasks/tasks/task/DL-1and tap the sample.zip attachment card. - Force-quit and reopen, open the thread, tap the sample-….zip chip (file preview shows "This file type can't be previewed."), then tap Download.
- Repeat step 6 on a profile whose server URL has a path prefix (
http://<host>/bb).
Expected vs actual
Expected: a save/share sheet for the file, and the app stays on the same page.
Actual:
- Steps 5 and 6 (root mount): the WebView navigates to the file URL and renders the bytes as text, for example
PK… note.txtUT … hello download PK…across the top of a blank page. A PDF attachment does the same (%PDF-1.4 1 0 obj<>endobj …). Opening abb://deep link does not bring the app back; only a force-quit does. - Step 7 (prefixed mount): Safari opens and asks "Do you want to download “content.zip”?" The name is wrong, and Safari has none of the WebView's cookies, so an authenticated server answers 401.
The server is fine: curl -D - on the same URLs returns 200 with the bytes (content-disposition: attachment; filename="sample.zip" for the Tasks route, content-type: application/zip for the raw file route).
Evidence (cause)
- Web download sites use plain anchors and never check for the native shell:
- File preview Download: FilePreview.tsx#L1303-L1307, with URLs from file-content-urls.ts
- Tasks attachment cards: attachments.tsx#L191-L193, task-activity.tsx#L125-L127
- Chat file chip fallback (
target="_blank", used when no attachment opener is mounted): ConversationAttachments.tsx#L197-L210 blob:anchor download (voice recordings, iOS app: "Download recording" on a failed voice input does nothing, so the audio is lost #5302): download-blob.ts
- The shell's WebView sets no
onFileDownloadoronOpenWindow: ProfileWebViewScreen.tsx#L310-L366. ItsonShouldStartLoadWithRequestallows any same-origin URL under the profile's path and sends everything else to Safari. react-native-webview 13.16.1 on iOS has no WKDownload support, so an allowed<a download>navigation is loaded and displayed in the main frame. - The bridge cannot carry a file: messages.ts only accepts http(s) URLs and text of at most 4000 characters.
- The prefixed-mount case goes to Safari because
/api/v1/...is outside the profile's/bbprefix (shell-url.ts#L28-L43).
What I ruled out / corrections to the audit
- Not "fails silently" on a root mount, as the code audit predicted: it is worse. The app is replaced by the raw file and stays stuck.
- "The Tasks download URL ignores the mount prefix" is not a separate bug. The whole web app is root-absolute (
/assets/…,window.location.origin + /api/v1), and loading/bb/immediately rewrites the URL to/. Abb://deep link on a prefixed profile also lands on the home page. Downloads are the visible symptom, but fixing the Tasks URL alone would not help. - Not a duplicate of iOS app: "Download recording" on a failed voice input does nothing, so the audio is lost #5302 (one site, fixed separately by keeping failed recordings in the composer) or Canonicalize attached and referenced file preview and download behavior #2697 (closed; preview/download canonicalization on the web).
- Not reproduced: the
blob:PDF-preview iframe on a prefixed mount. That remains code-derived.
Suggested priority and effort
Every file download in the iOS app is broken, and the root-mount case strands the user until a force-quit. No data is lost. Workaround: use Safari or desktop. Medium effort: a capability-negotiated native save path through the bridge, plus shell safety nets for older pages.
AGENT GENERATED
Activity
bb-slop-cop commentedon Oct 14, 2026
🚨 SLOP COP 🚨 ·
new-issue-autopilotmobile; reproduction label:partial-repro.Handle iOS file downloads with WebKit’s native download API (#5508)