fix: cap Base64 media transfers at 10 MB, upload limit at most 32 MB

This commit is contained in:
2026-09-26 05:04:38 +02:00
parent 7f58301a71
commit 28bb033a8b
12 changed files with 122 additions and 25 deletions
@@ -10,7 +10,8 @@ use WP_Error;
/**
* Uploads a Base64-encoded file into the media library (spec §6.3), up to the configured
* upload limit. Checks and cleanup: MediaImporter; permission and result: MediaUploads.
* upload limit (at most Limits::INLINE_MAX_MB, the request carries the whole file).
* Checks and cleanup: MediaImporter; permission and result: MediaUploads.
*/
final class MediaUploadAbility implements Ability
{
@@ -36,8 +37,8 @@ final class MediaUploadAbility implements Ability
return sprintf(
'Lädt eine Datei (Bild, PDF, MP4, MP3) als Base64 in die Mediathek, höchstens %d MB; optional mit '
. 'Titel, Alt-Text und Zuordnung zu einem Eintrag (post_id). Nicht idempotent: jeder Aufruf legt '
. 'ein neues Medium an.',
$this->limits->uploadMegabytes()
. 'ein neues Medium an. Größere Dateien per URL mit lit/media-upload-from-url importieren.',
$this->limits->inlineMegabytes()
);
}