Repository navigation
Media: Skip the multisite upload space check for sideloaded sub-sizes - #15954
adamsilverstein wants to merge 5 commits into
Conversation
On the classic path, only the original upload is checked against the site's upload space. The image editor then writes sub-sizes even when the original used the last of it. With client-side media processing, every sub-size is sideloaded and checked against the quota on its own, so it is rejected with "Not enough space to upload." and the attachment is left with missing sub-sizes, or deleted when they all fail. The first test is the classic baseline and passes. The second fails until the sideload endpoint stops checking the quota for an attachment's own sub-sizes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On multisite, the classic upload path checks only the original file against the site's upload space. The sub-sizes the server generates from it are written without a check. With client-side media processing each sub-size is sideloaded and was checked on its own, so a site close to its quota rejected some of them and left the attachment with missing sizes. Disable the space check while a sideloaded file is stored, so both paths treat an attachment's sub-sizes the same way. New uploads are still checked. See #66680. Claude-Session: https://claude.ai/code/session_018vwYjSXLpsi7LrGqx7UsrL
Add the `@ticket` annotation, assert the types PHPStan cannot infer, and drop the sentence describing the sideload check, which no longer runs. See #66680. Claude-Session: https://claude.ai/code/session_018vwYjSXLpsi7LrGqx7UsrL
The browser sends each sub-size as multipart form data, which takes a different upload handler than the raw request body the existing test uses. Also confirm the upload space check still applies to the next new upload. See #66680. Claude-Session: https://claude.ai/code/session_018vwYjSXLpsi7LrGqx7UsrL
Disabling the whole upload space check for a sideload also dropped the network's per-file size limit, which is unrelated to the space a site has left. Skip only the two space checks with a flag set while the file is stored, so a sideloaded file is still held to `fileupload_maxk`. See #66680. Claude-Session: https://claude.ai/code/session_018vwYjSXLpsi7LrGqx7UsrL
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. 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. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
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. |
adamsilverstein
left a comment
There was a problem hiding this comment.
Code looks good, running manual tests.
|
Manual testing on a multisite install confirms the bug on trunk and the fix in this PR, screencasts below. Claude ran the before and after on a multisite Playground site:
Before (trunk): trac-66680-before.mp4After (this PR): trac-66680-after.mp4 |
Claude Code wrote the fix on top of the tests from #15860, and this description:
Trac ticket: https://core.trac.wordpress.org/ticket/66680
AI Use
The fix and this description came from 🤖 Claude Code, building on the tests in #15860. I will review and test.
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.