Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Android: a media delete failure other than IOException loses its CORS headers

Aperta Adatta ai principianti
#847 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
79/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
kotlin
Ambito
backend, mobile

Direzione di ricerca

Leggi MediaUploadServer.handleDelete e confronta la gestione delle eccezioni con quella di passthroughResponse e processAndRespond. Assicurati che le eccezioni non dovute ad annullamento ricevano la risposta del server con intestazioni CORS, mentre CancellationException viene rilanciata; verifica che l’errore di eliminazione non si trasformi più in un 500 di ripiego senza CORS.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

[Type] Bug Android

On Android, a media delete that fails with anything other than an IOException gets a response without CORS headers. The editor then can't read it, and reports a generic network error instead of the real cause.

Follow-up from #594. Found by reading the code; not reproduced.

What happens

MediaUploadServer.handleDelete catches only IOException. The upload paths (passthroughResponse, processAndRespond) catch every Exception, so that a failure is still answered by the server with CORS headers.

Any other exception from the delete escapes to HttpServer's fallback 500, which carries no CORS headers. The web view rejects that response, and the page sees fetch_error ("Could not get a valid response from the server.").

Building the OkHttp request is one place this could happen: addHeader throws IllegalArgumentException for a header value containing a character it doesn't allow, such as a newline. MediaServerCredentials.areUsable only checks that the auth header isn't empty.

Who is affected

Android hosts whose loopback upload server is running (a mediaProcessor or mediaUploader is set). The main sender is core's orphan cleanup after an upload's post-process retries all fail. The cleanup fails either way; only the error the editor logs is wrong.

Suggested fix

Catch Exception in handleDelete, rethrowing CancellationException, as passthroughResponse does.

Lingua principale
JavaScript
Stelle
29
Fork
7
Merge medio
2g 3h
PR unite (30g)
70

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di wordpress-mobile/GutenbergKit

Tutte le issue di wordpress-mobile/GutenbergKit

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.