Skip to content

Open what the core can read, and say when it cannot - #183

Merged
andiwand merged 3 commits into
mainfrom
open-what-the-core-can-read
Aug 21, 2026
Merged

Open what the core can read, and say when it cannot#183
andiwand merged 3 commits into
mainfrom
open-what-the-core-can-read

Conversation

@andiwand

@andiwand andiwand commented Aug 21, 2026

Copy link
Copy Markdown
Member

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.

  • A zip opens and lists what is inside. Its entries open too — odrcore writes every
    link with target="_blank", which a web view with no window to open drops on the
    floor, so they lead nowhere without a WKUIDelegate. Swipe back returns to the
    listing.
  • .heic .heif .hif .jpe .dib .text now open. They were only failing
    because the list predated them, and .heic is what an iPhone camera writes.
  • A file that will not open closes the reader and says so over the document browser,
    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-content is out of both plists. odrcore plays a sound or a film
    because Android once did; a document reader should not be the handler for an mp3.

iWork keeps its rendering

.pages, .numbers and .key are zips, so "core decides" would have shown a file
listing 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
. .pages is; .zip
and .jar are 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 .epubcanShowMIMEType says so and odrcore's listing takes over.

Checked against real files

route result
.pages (real, 3 pages) system full render, snapshot identical to before
.epub system refuses → core listing
.zip core listing
.heic core image
.odt core document

Also 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:

Tests

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.
testUnsupportedFileTypeReportsTypedError was flaky — random bytes are often named as
a charset — and now uses every byte value instead.

🤖 Generated with Claude Code

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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread OpenDocumentReader/DocumentViewController.swift
Comment thread OpenDocumentReader/DocumentViewController.swift Outdated
andiwand and others added 2 commits August 21, 2026 17:13
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
@andiwand
andiwand merged commit 33aa2ae into main Aug 21, 2026
4 checks passed
@andiwand
andiwand deleted the open-what-the-core-can-read branch August 21, 2026 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant