fix(ios): declare txt and md in fileAssociations so Files offers Readest again - #5415
Merged
Conversation
…est again tauri-cli 2.11.0 (bumped in #5085) started generating the iOS CFBundleDocumentTypes from bundle.fileAssociations, replacing the hand-tuned array merged from src-tauri/Info.plist that carried the public.plain-text claim. fileAssociations listed every supported format except txt and md, so 0.11.20 builds stopped claiming plain text and the Files preview/share sheet dropped Readest for .txt files while EPUB/PDF kept working. Markdown rode on the same claim since its UTI conforms to public.plain-text, so .md was lost as well. Declaring txt with mimeType text/plain makes the generator emit LSItemContentTypes public.plain-text, restoring the claim; md gets an extension-based entry like epub, which iOS resolves through the extension to UTI mapping. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Regression in 0.11.20 (0.11.18 was fine): on iOS, previewing or sharing a
.txtfile from the Files app no longer offers Readest in the share sheet. EPUB and PDF were unaffected.Root cause
The app's plain-text claim used to come from the hand-tuned
CFBundleDocumentTypesinsrc-tauri/Info.plist(Text File/public.plain-text), merged into the generated iOSInfo.plistat build time.The tauri CLI bump 2.10.1 -> 2.11.4 (#5085) picked up tauri-cli 2.11.0's new mobile file associations feature (tauri-apps/tauri#14486): the CLI now generates
CFBundleDocumentTypesfrombundle.fileAssociationsand inserts the key after the custom-plist merge, replacing the hand-tuned array.fileAssociationslisted every supported format excepttxtandmd, so 0.11.20 builds silently stopped claimingpublic.plain-textand iOS dropped Readest as a handler for.txt. Markdown rode on the same claim (net.daringfireball.markdownconforms topublic.plain-text), so.mdwas lost as well.Fix
Declare
txtandmdinbundle.fileAssociations:txtwithtext/plain: tauri-utils maps it to thepublic.plain-textUTI and emitsLSItemContentTypes, restoring exactly the claim that was lost.mdwithtext/markdown: tauri-utils has no UTI mapping for markdown, so it gets an extension-based entry, the same shape that keeps EPUB working on iOS.Added a regression test asserting both entries (plus the seven pre-existing formats) stay in
fileAssociations, since the hand-tunedCFBundleDocumentTypesinsrc-tauri/Info.plistis dead on iOS for any key the CLI generates.Note:
fileAssociationsalso feeds the Windows installer registry and Linux mime entries, so desktop platforms now list Readest under Open With for.txt/.mdtoo (macOS already claimed plain text via the hand-tuned plist).Verification
pnpm lint,pnpm format:checkpasspnpm fmt:check,pnpm clippy:check,pnpm test:rustpass (Rust compile re-validates the modified config through tauri codegen)Info.plist🤖 Generated with Claude Code