fix: cap Base64 media transfers at 10 MB, upload limit at most 32 MB
This commit is contained in:
@@ -62,6 +62,18 @@ final class MediaDownloadAbilityTest extends TestCase
|
||||
self::assertSame('lit_unsupported', $result->get_error_code());
|
||||
}
|
||||
|
||||
public function testDownloadsAreCappedAtTenMegabytesEvenWithAHigherUploadLimit(): void
|
||||
{
|
||||
Functions\when('get_option')->justReturn(['upload_mb' => 32]);
|
||||
file_put_contents($this->file, str_repeat('x', 10 * 1024 * 1024 + 1));
|
||||
|
||||
$result = (new MediaDownloadAbility(new Limits()))->execute(['id' => 40]);
|
||||
|
||||
self::assertSame('lit_unsupported', $result->get_error_code());
|
||||
self::assertStringContainsString('Limit 10 MB', $result->get_error_message());
|
||||
self::assertStringContainsString('URL', (string) $result->get_error_data()['hint']);
|
||||
}
|
||||
|
||||
public function testUnknownSizeIsNotFound(): void
|
||||
{
|
||||
Functions\when('get_option')->justReturn([]);
|
||||
|
||||
Reference in New Issue
Block a user