Skip to content

fix(mobile): workspace PDFs with # or ? in the name get the Open PDF menu item - #45455

Open
iamshadmantaqi wants to merge 4 commits into
pingdotgg:mainfrom
iamshadmantaqi:fix/pdf-name-hash-open-pdf
Open

iamshadmantaqi wants to merge 4 commits into
pingdotgg:mainfrom
iamshadmantaqi:fix/pdf-name-hash-open-pdf

Conversation

@iamshadmantaqi

Copy link
Copy Markdown
Contributor

Problem

On mobile, a workspace PDF whose name has a # or ? in it gets no "Open PDF" item in its file actions menu.

Steps (no sign-in):

  1. In a workspace, create docs/Invoice #42.pdf and docs/report.pdf (any PDF).
  2. On the phone, open a thread in that project, open Files and browse to docs.
  3. Open report.pdf and tap the "..." file actions menu: "Open PDF" is there.
  4. Open Invoice #42.pdf: the PDF renders, but the menu has no "Open PDF" item. The same happens for Q&A?.pdf.

After the fix, all three names get "Open PDF".

Cause

ThreadFileScreen decides whether to show "Open PDF" with isPdfFile({ name: relativePath }). That helper is made for attachment names and URLs, so it cuts the name at the first ? or #. A workspace path is literal, so Invoice #42.pdf is read as Invoice and is not a PDF. The preview itself is fine, so only the menu item goes missing.

Merged #35448 fixed the same mistake for the audio, SVG and Markdown checks in this screen. The PDF check was missed.

Change

The menu uses filePreviewKind({ name: relativePath }) === "pdf", which the screen already imports and uses for the EPUB checks, and the unused isPdfFile import is dropped. isPdfFile keeps its URL behaviour for attachments. Two lines changed in ThreadFilesRouteScreen.tsx.

Scope

Small fix of an obvious bug, steps reproduce it, so it needs no issue.

Verification

The screen had no tests, so the new ThreadFilesRouteScreen.test.tsx stubs its dependencies and reads the File actions menu ids from the app bar props, for report.pdf, Invoice #42.pdf and Q&A?.pdf. It is added to the React test list in apps/mobile/vite.config.ts.

Test commit alone, on main bf9e985:

AssertionError: expected [ 'modes', 'copy-path', …(2) ] to include 'open-pdf'
Test Files  1 failed (1)
      Tests  2 failed | 1 passed (3)

With the fix, the new file together with filePreview.test.ts and filePath.test.ts:

Test Files  3 passed (3)
      Tests  104 passed (104)

and the new file alone: Tests 3 passed (3).

vp run check:changed: format, lint, knip (2 parts), typecheck (2 packages), test (1 file) and React Compiler (1 file) all pass.

Not verified: I did not run it on a phone or simulator; the test renders the screen with stubbed hooks and child views and checks the menu items it builds.

Model: Claude Opus 5.5. Harness: Claude Code in T3 Code.

@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Nov 29, 2026
@macroscopeapp

macroscopeapp Bot commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at fe8d456

Macroscope's review found this PR approvable — Restores the existing Open PDF action for workspace filenames containing # or ?, using literal filename classification. The existing preview availability check and user-triggered viewer remain unchanged.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The screen now uses filePreviewKind to identify PDFs for the menu action. A new test checks that a workspace PDF named Invoice #42.pdf offers the open-pdf menu item. The mobile React test project includes the test.

Changes: Workspace PDF menu action

Layer / File(s) Summary
PDF action detection
apps/mobile/src/features/files/ThreadFilesRouteScreen.tsx
The screen checks filePreviewKind({ name: relativePath }) === "pdf" and still requires a non-null preview URI before adding the PDF action.
Filename regression test
apps/mobile/src/features/files/ThreadFilesRouteScreen.test.tsx, apps/mobile/vite.config.ts
The test checks that a workspace PDF named Invoice #42.pdf shows the open-pdf menu item. The mobile React test project now includes this test.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Low

Merge Risk: Minimal · up to 58677

This change makes the file actions menu offer the PDF action for workspace PDFs whose names contain # or ?. The change is small and low risk. A regression test covers plain, # and ? filenames. It is ready to merge, though behavior on a real device was not tested.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the mobile file actions menu now shows the Open PDF item for workspace PDFs whose names contain # or ?. It matches the changeset, which switches the PDF check to fileP…
Description check Passed The description follows the template. Problem gives the bug, reproduction steps, and cause. Change explains the two-line fix and the retained isPdfFile URL behavior. Scope says why no issue is needed …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: the mobile file actions menu now shows the Open PDF item for workspace PDFs whose names contain # or ?. It matches the changeset, which switches the PDF check to filePreviewKind and adds a test for those names. The title follows the conventional commit form the template asks for.

Full details: Description check

Explanation

The description follows the template. Problem gives the bug, reproduction steps, and cause. Change explains the two-line fix and the retained isPdfFile URL behavior. Scope says why no issue is needed for this small obvious bug. Verification lists the focused tests with before and after results, and it states what was not checked. It also names the model and harness, as the template asks. The description does not include screenshots, but the change has no UI layout change and the author explains the lack of device testing, so this is a minor gap at most.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between fe8d456 and 586779b.

Files selected for processing: 1

  • apps/mobile/src/features/files/ThreadFilesRouteScreen.test.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.

@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Nov 29, 2026
juliusmarminge and others added 2 commits November 29, 2026 10:53
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS 0-9 changed lines (additions + deletions). takeover:in-progress A takeover lead is working on this PR vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants