Skip to content

Offer another app when a document's preview fails on iOS - #1815

Merged
robertying merged 1 commit into
mainfrom
claude/project-thread-esuhc1
Nov 24, 2026
Merged

robertying merged 1 commit into
mainfrom
claude/project-thread-esuhc1

Conversation

@robertying

Copy link
Copy Markdown
Owner

Requested by Rui · project thread

What

On iOS, File detail shows Office and iWork documents in a web view, which WebKit converts with Quick Look. When Quick Look can't read the file (a damaged or mislabeled .ppt, for example), WebKit shows its own "This file cannot be previewed" page, and File detail had nothing to offer beyond it.

  • react-native-webview patch (iOS): a load that fails after it was committed (didFailNavigation) now reaches onError, as one that fails before it does (didFailProvisionalNavigation). WebKit reports a failed Quick Look conversion that way (QuickLookErrorDomain, code 912); upstream 14.0.1 ignores it, so the view never ended the load and JS never heard of it. The same ignored errors (cancelled loads, WebKit 101/102) are skipped for both.
  • File detail: a web view error shows the preview-failed state, as an unreadable PDF already does. That state now offers the file to another app next to Download Again: the share sheet on iOS, Quick Look on the Mac, the chooser on Android, and the default app on Windows and Linux. The PDF password state uses the same action, so Windows and Linux now get Open in Default App there instead of Share.
  • Wording: 文件可能已损坏,可在其他应用中打开或重新下载。 / "It may be damaged. Open it in another app or download it again."
  • Versions: the patch is native and 19.1.0's builds are made without it, so the app and runtime versions move to 19.2.0, with the fingerprint record updated.

A valid PowerPoint 97 .ppt previews correctly in the web view on iOS 27.2. Only files Quick Look can't parse fail.

Tests

  • ios/learnXTests/Patches/WebViewPatchTests.swift: a committed failure is sent as onError with its domain and code, and cancelled or interrupted loads are not.
  • src/screens/__tests__/FileDetail.test.tsx: a web view error shows the preview-failed state with Share and Download Again, the header still switches to the info page, and the Electron app offers Open in Default App. The unreadable PDF case also checks Share.
  • pnpm check passes locally, except lint:shell, which needs shellcheck installed (no shell scripts changed).

Generated by Claude Code

WebKit's Quick Look conversion of a document it can't read, such as a
damaged .ppt, fails after the load is committed (didFailNavigation,
QuickLookErrorDomain). react-native-webview handled only provisional
failures, so File detail never heard of it and showed WebKit's own
"This file cannot be previewed" page with nothing to do.

The webview patch now reports committed failures through onError, and
File detail shows its preview-failed state for them, as for an unreadable
PDF. That state now offers the file to another app (share sheet on iOS,
Quick Look on the Mac, the chooser on Android, the default app on Windows
and Linux) next to Download Again.

The patch is native, and 19.1.0's builds are made without it, so the app
and runtime versions move to 19.2.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@robertying robertying self-assigned this Nov 24, 2026
@robertying
robertying merged commit 167eb6e into main Nov 24, 2026
14 checks passed
@robertying
robertying deleted the claude/project-thread-esuhc1 branch November 24, 2026 08:13
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.

2 participants