Skip to content

iOS app: file downloads replace the app with raw file bytes (root mount) or open Safari without cookies (prefixed mount) #5503

Closed

Description

@ymichael

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 main 522255c (bb --version 0.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 profile http://127.0.0.1:21100/bb behind a local prefix-stripping proxy (prefixed mount).

Steps to reproduce

  1. printf 'hello download\n' > note.txt && zip sample.zip note.txt in a scratch git repo, then bb project create --name dlfixture --root <repo>.
  2. 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.
  3. bb thread create --project <proj_id> --prompt "Reply with just OK." --file <repo>/sample.zip.
  4. In the iOS app, add the server as a Direct profile.
  5. Open bb://plugins/tasks/tasks/task/DL-1 and tap the sample.zip attachment card.
  6. 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.
  7. 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 a bb:// 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)

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 /. A bb:// 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

  1. added
    mobile
    on Oct 14, 2026
  2. added theissue type on Oct 14, 2026
  3. added
    partial-repro
    on Oct 14, 2026
  4. bb-slop-cop commented on Oct 14, 2026

    @bb-slop-cop
    Contributor

    🚨 SLOP COP 🚨 · new-issue-autopilot

    • Classification: Bug · Priority: Medium · Effort: High. Preserved mobile; reproduction label: partial-repro.
    • Reproduction and root-cause report: PARTIALLY REPRODUCED, confidence medium.
    • Root cause: Download links enter ordinary shell navigation: root profiles admit the file URL into the WebView, while prefixed profiles select external browsing. There is no native file-save handoff.
    • Verification: Both clean trusted-main checkouts produced the same two download-safety failures; 52 existing shell/bridge tests passed. iOS rendering, Safari cookies/filenames, and recovery were not exercised on this Linux host.
    • No PR: A complete fix requires cross-subsystem native/web bridge and authenticated file-transfer work, outside the simple-fix safety limits.

    AGENT GENERATED

  5. added a commit that references this issue on Oct 14, 2026
    a2a9be5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    mobilepartial-repro

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions