Open what the core can read, and say when it cannot - #183
Merged
Conversation
A zip file opens and lists what is inside, and tapping an entry shows it. Photos and text files the reader used to refuse open too. The reader now asks the core what it can read rather than keeping a list of its own, which had gone out of date. A file that will not open says so, and offers to write to us when something went wrong on our side. Music and films are no longer offered. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AHynmW7Vk9bXvUFxLkwu6W
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a0080967a4
ℹ️ 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".
The browser opens a file before it puts the reader on screen, so one that fails straight away had nowhere to show its message and it was lost. It now waits for the screen it is about to be given. Only a message that really offers the way to write to us is counted as one. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AHynmW7Vk9bXvUFxLkwu6W
The explanations of why the reader does what it does were longer than the code they sat above. What is left says what is not plain from reading it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SNdCgkkN5mytCQT5RwPzse
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.
Opening a zip offered the reader and then failed. Fixing that turned up the same
problem from both sides: the reader kept its own list of formats to hand to the web
view, and that list had gone out of date.
What changed
The reader asks odrcore what it can read instead of deciding for itself. The list of
45 extensions is gone.
link with
target="_blank", which a web view with no window to open drops on thefloor, so they lead nowhere without a
WKUIDelegate. Swipe back returns to thelisting.
.heic.heif.hif.jpe.dib.textnow open. They were only failingbecause the list predated them, and
.heicis what an iPhone camera writes.the way OpenDocument.droid does. Three outcomes, and only one asks for mail:
a format odrcore cannot read, a locked legacy Office file, and a file odrcore took
and then could not show. The last also fires on a served page answering 4xx/5xx and
on a web view navigation failure. The four strings are lifted from Android's own
translations in all 16 languages, so both apps say the same thing.
public.audiovisual-contentis out of both plists. odrcore plays a sound or a filmbecause Android once did; a document reader should not be the handler for an mp3.
iWork keeps its rendering
.pages,.numbersand.keyare zips, so "core decides" would have shown a filelisting where the system used to draw the document properly. They keep the system's
rendering, but through a condition that names no format: odrcore saw only a
container, and the system knows this file as composite content.
.pagesis;.zipand
.jarare not.It retires itself twice over. The day odrcore reads iWork, the file stops being an
archive to it and the branch never fires. And if the system turns out not to be able
to draw it — an
.epub—canShowMIMETypesays so and odrcore's listing takes over.Checked against real files
.pages(real, 3 pages).epub.zip.heic.odtAlso verified end to end with the 64 MB zip of photos that started this.
Upstream
odrcore never rejects anything — its last resort is "this is a text file", which it
returns for an empty file, a database or a program, then serves 27 KB of nonsense. The
charset check that catches it is Android's, and it is a workaround in both apps now:
the charset check misses NUL-padded binaries
translate_htmlcannot tell a format whosepage renders from one whose page is blank, which is why
.psdand.jp2now show ablank page instead of the old message
target="_blank"on every viewTests
65 pass. New coverage for the archive listing and its links, the routing between core
and the system, the charset refusal and its counterpart, and each failure message.
testUnsupportedFileTypeReportsTypedErrorwas flaky — random bytes are often named asa charset — and now uses every byte value instead.
🤖 Generated with Claude Code