Android: media uploads don't recover from post-processing failures when the REST API is cross-origin
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 42/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- android, javascript
調査の方向性
Start with the limitation described in the comment above apiFetch.use( nativeMediaUploadMiddleware ) in src/utils/api-fetch.js, then trace Android’s upload server and cross-origin request handling. Compare the two proposed fixes: starting the native upload server when credentials exist, or adding a REST relay like iOS’s gbk-rest: relay. Done means failed post-processing can be retried and orphaned attachments cleaned up for the affected Android uploads.
索引モデルが issue の本文から書いたものです。
説明
On Android, a media upload that fails in server-side post-processing is not recovered when the site's REST API is on another origin and the host hasn't set a mediaProcessor or mediaUploader. The user is left with an orphaned attachment, and retrying duplicates it. This is the bug #594 fixes everywhere else.
Follow-up from #594.
What happens
When wp_generate_attachment_metadata() fatals, WordPress returns a 5xx and sends the new attachment's ID in X-WP-Upload-Attachment-ID. Core's mediaUploadMiddleware, registered in #594, reads that header to retry post-process and, if every retry fails, to delete the attachment.
Without a mediaProcessor or mediaUploader, Android doesn't start the native upload server, so the upload goes straight from the web view to WordPress. A cross-origin page can only read the response headers the server lists in Access-Control-Expose-Headers. WordPress doesn't list X-WP-Upload-Attachment-ID, so core never sees the ID. No post-process retry and no cleanup are sent.
Who is affected
Android hosts without a mediaProcessor or mediaUploader, editing a site whose REST API is not on the site's own origin. The main case is WP.com sites, whose API is public-api.wordpress.com. Its CORS response exposes only X-WP-Total, X-WP-TotalPages, Link, checked on 2026-10-29.
Not affected:
- iOS: every upload with site credentials goes through native code, which exposes the header. Verified in the Simulator for #594.
- Android with a
mediaProcessorormediaUploader: uploads go through the loopback server, which exposes the header and also relays the cleanupDELETE. - Android on a self-hosted site:
GutenbergViewserves the editor from the site's origin, port included, so the REST API is same-origin. Retry and cleanup both work directly.
Possible fixes
1. Start the native upload server whenever site credentials exist
Every upload and media delete would then go through native code, as on iOS. This is the smaller change, but it adds a full file copy for hosts that don't process media today.
2. Add a REST relay on Android
Match iOS's gbk-rest: relay, so requests to other origins are sent from native code. This is a larger change, and it also covers other headers WordPress hides cross-origin, such as Allow.
Related
- The comment above
apiFetch.use( nativeMediaUploadMiddleware )insrc/utils/api-fetch.jsdescribes this limitation. It was corrected in e9306abbc, on #594.
- 主要言語
- JavaScript
- スター
- 29
- フォーク
- 6
- 平均マージ
- 2日 1時間
- マージ済み PR(30日)
- 76
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
wordpress-mobile/GutenbergKit のほかの issue
-
[Type] Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
wordpress-mobile/GutenbergKit#940 ·
メンテナーはふだん 1 日以内に返信
-
[Type] Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
wordpress-mobile/GutenbergKit#884 ·
メンテナーはふだん 1 日以内に返信
-
[Type] Bug Android
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
wordpress-mobile/GutenbergKit#847 ·
メンテナーはふだん 1 日以内に返信
-
[Type] Bug iOS
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
wordpress-mobile/GutenbergKit#846 ·
メンテナーはふだん 1 日以内に返信
-
[Type] Bug [Type] Code Quality iOS
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
wordpress-mobile/GutenbergKit#668 ·
メンテナーはふだん 1 日以内に返信
wordpress-mobile/GutenbergKit の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 13 日以内に返信
-
[BUG]: chunkSource protocol stripping truncates URLs or reads an inner scheme対応中かも @Bensonbenyi が今日担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
Mintplex-Labs/anything-llm#7338 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
bug: no-derived-state crashes on a call through a TypeScript import-equals alias (`import x = A.b`)オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
nickjvandyke/eslint-plugin-react-you-might-not-need-an-effect#90 · コメント 1 件 · リアクション 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
semantic-release/semantic-release#4375 ·
メンテナーはふだん 1 日以内に返信