Repository navigation
fix(mobile): workspace PDFs with # or ? in the name get the Open PDF menu item - #45455
iamshadmantaqi wants to merge 4 commits into
Conversation
ApprovabilityVerdict: Approved at 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. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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):
docs/Invoice #42.pdfanddocs/report.pdf(any PDF).docs.report.pdfand tap the "..." file actions menu: "Open PDF" is there.Invoice #42.pdf: the PDF renders, but the menu has no "Open PDF" item. The same happens forQ&A?.pdf.After the fix, all three names get "Open PDF".
Cause
ThreadFileScreendecides whether to show "Open PDF" withisPdfFile({ 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, soInvoice #42.pdfis read asInvoiceand 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 unusedisPdfFileimport is dropped.isPdfFilekeeps its URL behaviour for attachments. Two lines changed inThreadFilesRouteScreen.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.tsxstubs its dependencies and reads the File actions menu ids from the app bar props, forreport.pdf,Invoice #42.pdfandQ&A?.pdf. It is added to the React test list inapps/mobile/vite.config.ts.Test commit alone, on main bf9e985:
With the fix, the new file together with
filePreview.test.tsandfilePath.test.ts: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.