Default to strict file-type registration (fixes #477)#479
Conversation
The app registered a true catch-all VIEW intent-filter (content/file scheme with no MIME/extension constraint plus */*), so the OS offered OpenDocument Reader for unrelated content like vCard/contact URIs (issue #477). A narrower STRICT_CATCH activity-alias and a landing-screen toggle already existed, but CATCH_ALL was the default and the old code force-enabled it on every launch. This makes STRICT_CATCH the default: - Manifest: CATCH_ALL android:enabled=false, STRICT_CATCH android:enabled=true, so fresh installs are strict from first launch. - MainActivity: drive the alias choice from a SharedPreferences flag instead of component state. New installs and existing users who never used the switch default to strict; an explicit toggle is remembered. Users who want the old behavior can still opt in via the switch. - Update the landing-screen help text for the inverted default. Renew the STRICT_CATCH type list to match what the app actually opens: - CoreLoader: add ODF graphics MIME types (the .odg extension patterns were already registered) and xlsx (spreadsheetml.sheet) MIME type and .xlsx extension patterns. pptx stays out since the core disables it. - RawLoader: keep text, images, csv and zip openable by default by registering text/plain, text/csv, image/* and application/zip plus .txt/.csv/.zip extension patterns. text/plain is used deliberately instead of text/* so text/vcard contacts are not matched again (#477). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XXRLLpHb7kGTr6tic2H9LZ
492b1c5 to
27ac474
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 492b1c5c6e
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
|
||
| <activity-alias | ||
| android:name="at.tomtasche.reader.ui.activity.MainActivity.CATCH_ALL" | ||
| android:enabled="false" |
There was a problem hiding this comment.
Preserve file-URI extension matching in strict mode
Disabling CATCH_ALL removes the only default filter that matches an ACTION_VIEW intent carrying a bare file:///.../name.odt URI with no MIME type: the strict extension filters below all require an authority via android:host="*", while normal file:/// URIs have no host. Legacy file managers that send supported documents this way will stop showing the app unless users opt into all-file-types, even though strict mode is supposed to cover document extensions.
Useful? React with 👍 / 👎.
| </activity-alias> | ||
| <activity-alias | ||
| android:name="at.tomtasche.reader.ui.activity.MainActivity.STRICT_CATCH" | ||
| android:enabled="true" |
There was a problem hiding this comment.
Keep strict mode from matching generic binary MIME
Enabling STRICT_CATCH by default also enables its MIME-only application/octet-stream entry. Android treats a type-only filter as matching content:/file: URIs with that MIME type, so any provider that reports a generic binary type for an unrelated file will still offer OpenDocument Reader with the catch-all switch off. Constrain octet-stream handling to the extension-based filters or remove it from strict mode so the new default is actually document-only.
Useful? React with 👍 / 👎.
|
🤖 Generated with Claude Code @codex - Both suggestions are valid observations, but they're deliberate tradeoffs rather than regressions, so leaving strict mode as-is: P2 – P2 – hostless Net: #477 (vCard/contacts catch-all) is fixed, and the strict default stays document-oriented while still covering the common provider cases. |
|
To use Codex here, create a Codex account and connect to github. |
🤖 Generated with Claude Code
Problem
The app registered a true catch-all
VIEWintent-filter (content/filescheme with no MIME/extension constraint, plus*/*). As a result the OS offered OpenDocument Reader for completely unrelated content — including vCard/contact URIs, as reported in #477.Root cause
A narrower
STRICT_CATCHactivity-alias (specific document MIME types + extension patterns) and a landing-screen toggle to switch between them already existed. The real issue was thatCATCH_ALLwas the default, and the old code force-enabled it on every launch — so narrowing was never a blocker, it just wasn't the default.Changes
CATCH_ALL→android:enabled="false",STRICT_CATCH→android:enabled="true", so fresh installs are strict from the very first launch (even a cold VIEW-intent launch).MainActivity: the alias choice is now driven by aSharedPreferencesflag instead of unreliable component state. New installs and existing users who never touched the switch default to strict; an explicit toggle is remembered. Users who genuinely want catch-all can still opt in via the landing-screen switch.MIME/extension list renewal
Audited the
STRICT_CATCHlist against what the app actually opens (CoreLoader.isSupported,RawLoaderwhitelist/blacklist, PDF via pdf2htmlEX) and updated it.Document types (
CoreLoader) — fixed gaps:…opendocument.graphics/…graphics-template) — the.odgextension patterns were already registered but the MIME type was missing, so.odgcontent URIs didn't match.…spreadsheetml.sheet) MIME type +.xlsxextension patterns — supported byCoreLoaderwith OOXML enabled (the default), previously unreachable in strict mode except viaapplication/octet-stream.pptxintentionally left out — the core still has it disabled (TODO inCoreLoader).Raw types (
RawLoader) — kept openable by default:text/plain,text/csv,image/*andapplication/zip, plus.txt/.csv/.zipextension patterns, so plain text, images, CSV and zip still offer the app by default.text/plainis used deliberately instead oftext/*— atext/*wildcard would re-matchtext/vcardand reintroduce the exact contacts bug from App registers itself as being able to open signal links from contacts app #477. (RawLoaderalso blackliststext/vcard, so the app never wanted them anyway.)Behavior change note
Existing users who relied on the catch-all default now only get offered for the types above by default. They can re-enable all-file-types with the landing-screen switch. This is the intended fix for #477.
Testing
./gradlew :app:compileProDebugJavaWithJavac— passes./gradlew :app:processProDebugMainManifest— manifest merges cleanly