feat: media upload by URL and base64 with whitelist and size limit

MediaImporter streams URL imports via wp_safe_remote_get with limit_response_size,
checks Content-Length, intersects the MIME whitelist with get_allowed_mime_types and
validates real content; base64 is size-checked before decoding. Server-side failures
are write_failed; a failed alt text deletes the new attachment again (or partial_write).
MediaUploads is the shared permission/result helper of both upload abilities.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01At3V6SjwbMe6eMzVGW3Hs7
This commit is contained in:
2026-09-26 02:37:43 +02:00
co-authored by Claude Opus 5.5
parent f027da1785
commit 2e29a6cd4d
9 changed files with 1086 additions and 4 deletions
@@ -19,6 +19,8 @@ final class MediaIntegrationTest extends TestCase
'lit/media-search',
'lit/media-get',
'lit/media-preview',
'lit/media-upload-from-url',
'lit/media-upload',
'lit/media-download',
];