Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

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

Open Beginner friendly
#847 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
79/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
kotlin
Domain
backend, mobile

Research direction

Read MediaUploadServer.handleDelete and compare its exception handling with passthroughResponse and processAndRespond. Ensure non-cancellation exceptions receive the server response with CORS headers while CancellationException is rethrown; verify the delete failure no longer becomes a CORS-less fallback 500.

Written by the indexing model from the issue text.

Description

[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.

Dominant language
JavaScript
Stars
29
Forks
7
Avg merge
2d 11h
Merged PRs (30d)
75

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from wordpress-mobile/GutenbergKit

All issues in wordpress-mobile/GutenbergKit

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.