Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

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

未关闭 适合新手
#847 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
79/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
kotlin
领域
backend, mobile

调研方向

阅读 MediaUploadServer.handleDelete,并将其异常处理与 passthroughResponse 和 processAndRespond 进行比较。确保非取消异常会收到带有 CORS 标头的服务器响应,而 CancellationException 会被重新抛出;验证删除失败不再变成不带 CORS 的备用 500 响应。

由索引模型根据 Issue 内容生成。

描述

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

主要语言
JavaScript
星标
29
派生
7
平均合并
2 天 3 小时
30 天内合并 PR
70

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

wordpress-mobile/GutenbergKit 的其他 Issue

查看 wordpress-mobile/GutenbergKit 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。