Android: media uploads don't recover from post-processing failures when the REST API is cross-origin
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 42/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- android, javascript
- Área
- backend-api-design, mobile
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- JavaScript
- Estrellas
- 29
- Forks
- 6
- Merge medio
- 2 d 1 h
- PR fusionados (30 d)
- 76
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de wordpress-mobile/GutenbergKit
-
[Type] Bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
wordpress-mobile/GutenbergKit#940 ·
Los mantenedores suelen responder en 1 día
-
[Type] Bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
wordpress-mobile/GutenbergKit#884 ·
Los mantenedores suelen responder en 1 día
-
[Type] Bug Android
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
wordpress-mobile/GutenbergKit#847 ·
Los mantenedores suelen responder en 1 día
-
[Type] Bug iOS
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
wordpress-mobile/GutenbergKit#846 ·
Los mantenedores suelen responder en 1 día
-
[Type] Bug [Type] Code Quality iOS
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
wordpress-mobile/GutenbergKit#668 ·
Los mantenedores suelen responder en 1 día
Todos los issues de wordpress-mobile/GutenbergKit
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 13 días
-
[BUG]: chunkSource protocol stripping truncates URLs or reads an inner schemePosiblemente ocupada @Bensonbenyi la tomó hoy. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
Mintplex-Labs/anything-llm#7338 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
Los mantenedores suelen responder en 1 día
-
bug: no-derived-state crashes on a call through a TypeScript import-equals alias (`import x = A.b`)Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 80/100
nickjvandyke/eslint-plugin-react-you-might-not-need-an-effect#90 · 1 comentario · 1 reacción ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
semantic-release/semantic-release#4375 ·
Los mantenedores suelen responder en 1 día