Repository navigation
fix(bundle): list Markpad in Finder's Open With for .mdown and .mkd - #1027
Merged
Merged
Conversation
#1019 added both extensions to the Markdown file association, but on macOS an association with LSItemContentTypes ignores CFBundleTypeExtensions. The system's net.daringfireball.markdown only tags .md and .markdown, so .mdown and .mkd get dynamic UTIs that no association claimed. Move them to a second association with no content or MIME type, which Tauri emits as an extension-only document type. Windows registers the same ProgID and Linux the same MIME type as before.
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.
What this is
After #1019, a macOS build still did not show Markpad in Finder's Open With for
.mdownand.mkdfiles..mdand.markdownwere fine. This moves the two extensions into a second file association that macOS matches by extension.Mechanism
Tauri writes each
fileAssociationsentry as oneCFBundleDocumentTypesitem. The Markdown entry hascontentTypes, so it getsLSItemContentTypes, and when that key is present macOS ignoresCFBundleTypeExtensions. The entry only claimsnet.daringfireball.markdownandpublic.markdown.The system declares
net.daringfireball.markdownitself (CoreTypes, exported) with the tags.md,.markdownandtext/markdown..mdownand.mkdare not in it, so macOS gives them dynamic UTIs (dyn.ah62d4rv4ge8043dts71a,dyn.ah62d4rv4ge80445e) and no association claimed those.I first tried the usual fix, a
UTImportedTypeDeclarationsentry fornet.daringfireball.markdownwith all four extensions, merged in throughsrc-tauri/Info.plist. Tauri has no config key for an imported type, onlyexportedType. It did not work: Launch Services registered the import asinactive imported, because the system's exported declaration wins. Xcode's and Claude's imports of the same type are inactive the same way.UTType(filenameExtension: "mdown")stayed dynamic and Open With did not change. Exporting the type would mean claiming a type Markpad does not own, and the system export would still win.Fix
fileAssociationsnow has two entries.mdandmarkdownkeep the content types and MIME type.mdownandmkdgo in an entry with nocontentTypesand nomimeType. Tauri infers no UTI for those extensions, so it writes a document type with onlyCFBundleTypeExtensions, and Launch Services claims their dynamic UTIs by extension.Other platforms produce the same output as before. The NSIS template runs
APP_ASSOCIATEper extension with the association's name and description, and both entries useMarkdown File, the ProgIDhooks.nsiregisters under. Linux.desktopfiles list only MIME types, andtext/markdownis still listed once.Tests
scripts/fileAssociations.test.tsadds one test: an association withcontentTypeslists onlymdandmarkdown, any other association has nomimeType, and every association is namedMarkdown File. With the oldtauri.conf.jsonit fails (actualhasmdownandmkdin the content-typed entry). With this one it passes. The existing test still pins the full extension list toMARKDOWN_LINK_EXTENSIONSminustxt.Verification
On macOS 27.0.1, I built
--bundles appwith a separate identifier (dev.pathgao.markpad.utitest), registered it withlsregister -f, and askedNSWorkspace.urlsForApplications(toOpen:)for newly created files. Launch Services does not list apps under/private/tmpin Open With, even for.md, so I copied the bundle to a folder in my home directory first.Before (master):
Imported type tried and dropped:
After (this branch):
mdlsstill reports the dynamic UTI for.mdownand.mkd. That is expected, because the file type does not change. Markpad now claims it.npm run check,npm test,npx vitest run,cargo fmt --check,cargo clippy --all-targets -D warningsandcargo testpass.npm auditreports the same three dev-dependency findings as master (--omit=dev: 0).Not verified: I did not click through Finder's Open With menu by hand. I checked the same Launch Services query it relies on. I also did not build the Windows or Linux installers. Their output is unchanged by reading the bundler templates.