Media: Correct error message for rejected image uploads - #13059
Media: Correct error message for rejected image uploads#13059benitoalba wants to merge 1 commit into
Conversation
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Summary
Plupload currently maps every image
HTTP_ERRORto the image-processing message, including HTTP 4xx responses from hosting security layers. This makes a ModSecurity rejection look like an image-size or 2560-pixel failure.This change uses the existing generic HTTP error for image uploads rejected with a 4xx response. Image/server failures outside the 4xx range retain the existing image-processing guidance, and non-image behavior is unchanged.
The patch does not alter filename sanitization or attempt to bypass the hosting firewall. A clean Core environment accepts
test'image.jpgand stores it astestimage.jpg; the original host-specific ModSecurity rejection is not reproducible locally without intercepting the response.Trac ticket: https://core.trac.wordpress.org/ticket/64617
Testing
npm run test:e2e -- tests/e2e/specs/media-upload.test.js— 4 passednpm run grunt -- jshint:corejs— passednpm run typecheck:js— passednpm run grunt -- qunit:compiled— build completed, then Grunt's Windowsnpxlauncher returnedspawn EINVALnpx playwright test --config tests/qunit/playwright.config.js— 2 passed; 566/566 compiled and 566/566 source tests passedThe E2E coverage verifies a clean apostrophe-containing JPEG upload, an intercepted HTTP 403 response using the generic response message without 2560-pixel guidance, and an intercepted HTTP 500 response retaining the image-processing guidance.
Use of AI Tools
AI assistance: Yes
Tool(s): OpenAI Codex
Model(s): GPT-5.6 Sol, GPT-5.6 Luna
Used for: Planning, implementation, test authoring, local validation, and an independent final patch review.
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.