fix(launch): stop claiming icon ownership of .sql, .sqlite, and .duckdb files#1595
Merged
Conversation
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.
Fixes #1594
Problem
After installing TablePro, its icon appeared on .sql and .duckdb files in Finder even when TablePro was not the default app for those types.
Root cause
Info.plist exported three UTIs TablePro does not own: com.tablepro.sql, com.tablepro.sqlite-db, and com.tablepro.duckdb. An exported declaration tells Launch Services the app is the authority for that type, so Finder binds the extensions to TablePro's type and shows its icon regardless of the user's default app choice. LSHandlerRank=Owner on the SQL and DuckDB document types amplified the claim. The conformance references public.sql and com.apple.sqlite3 were dangling: neither UTI exists on macOS.
Fix
Per Apple's guidance (Tech Talk 10696, "Defining file and data types for your app"): export only types you created, import types invented elsewhere using the original identifier.
No Swift code changes: the file-open pipeline (URLClassifier) dispatches on file extension strings and never consults UTIs. Verified open/save panels use UTType(filenameExtension:) dynamic lookup and keep working.
This matches what TablePlus, Sequel Ace, CotEditor, and BBEdit ship: Owner only for proprietary formats, no exported UTIs for formats they did not create.
Rollout
Launch Services re-registers the new declarations on first launch after update. No reboot needed. Finder's icon cache can lag; killall Finder refreshes it. User "Change All" default-app choices are preserved.
Tests
Added to URLClassifierTests: .sql routes to openSQLFile, .duckdb and .ddb route to openDatabaseFile with the DuckDB type, unknown extensions return nil. All pass. swiftlint --strict clean.