#48542 closed defect (bug) (fixed)
Uploading a large image through the block editor fails
Reported by: | azaozz | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 5.3 | Priority: | highest omg bbq |
Severity: | blocker | Version: | 5.3 |
Component: | Editor | Keywords: | has-patch needs-testing commit dev-reviewed |
Focuses: | Cc: | ||
PR Number: |
Description
Seems the new functionality to retry post-processing is triggered correctly but the new REST API end point post-process
always returns a 404 error.
Attachments (1)
Change History (11)
#1
@
3 months ago
- Keywords needs-patch added
- Priority changed from normal to highest omg bbq
- Severity changed from normal to blocker
This ticket was mentioned in Slack in #core-editor by azaozz. View the logs.
3 months ago
#3
@
3 months ago
- Keywords has-patch needs-testing added; needs-patch removed
In 48542.diff: move wp.apiFetch.createRootURLMiddleware()
before wp.apiFetch.use( wp.apiFetch.mediaUploadMiddleware );
as suggested on Slack: https://wordpress.slack.com/archives/C02RQC26G/p1573247239138300.
The alternative solution of doing apiFetch()
instead of next()
in /middlewares/media-upload.js
seems perhaps riskier change at this point.
Thanks @mikeschroder, @TimothyBlynJacobs, and @epiqueras for looking at this asap :)
#4
@
3 months ago
I know this is somewhat hard to test/trigger the retry requests. Here's an image that may do it: https://upload.wikimedia.org/wikipedia/commons/f/ff/Pizigani_1367_Chart_10MB.jpg
To test: download that image, then drop it in a new "image" block in the block editor (make sure the Gutenberg plugin is not installed or is disabled), and watch the network tab in the browser tools.
As this is a "high density" 10MB JPEG image it fails to get post-processed on the initial request on my test server, even with the default sub-sizes and PHP settings. Alternatively few more large sub-sizes may need to be added or the max_execution_time=30
setting in php.ini may need to be reduced for this test.
#5
@
3 months ago
I reproduced the issue with the Pizigani_1367_Chart_10MB.jpg image locally and saw the Media upload failed
error message due to a 500 response from wp-json/wp/v2/media?_locale=user
and the successive 404s from wp/v2/media/141/post-process?_locale=user
.
After applying 48542.diff, the request to wp-json/wp/v2/media?_locale=user
still returns a 500 as expected, but the subsequent request to wp-json/wp/v2/media?_locale=user
now uses the correct URL and returns a 200. The image appears as expected and the image sizes are all generated correctly.
I'm unable to assess whether the fix is a technically good one, but I can confirm that it fixes the issue.
#6
@
3 months ago
I'd say that the best solution would be to ensure the media middleware is independent of the root URL middleware by using the full URL there too. I think landing the currently proposed core patch is a good change regardless.
LGTM 👍
Testing in both trunk and the 5.3 branch, requests to
wp/v2/media/12345/post-process?_locale=user
and towp/v2/media/12345?force=true&_locale=user
withX-HTTP-Method-Override: DELETE
are 404.Discussion in Slack: https://wordpress.slack.com/archives/C02RQC26G/p1573246877137300.