X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/d5b7fff102b31fa464ba368560ae8910152ab3e6..refs/heads/svg_image:/app/Http/Controllers/Controller.php diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index c00ac938b..01911808f 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -127,9 +127,11 @@ abstract class Controller extends BaseController protected function streamedDownloadResponse($stream, string $fileName): StreamedResponse { return response()->stream(function () use ($stream) { - // End & flush the output buffer otherwise we still seem to use memory. + + // End & flush the output buffer, if we're in one, otherwise we still use memory. + // Output buffer may or may not exist depending on PHP `output_buffering` setting. // Ignore in testing since output buffers are used to gather a response. - if (!app()->runningUnitTests()) { + if (!empty(ob_get_status()) && !app()->runningUnitTests()) { ob_end_clean(); } @@ -217,6 +219,6 @@ abstract class Controller extends BaseController */ protected function getImageValidationRules(): array { - return ['image_extension', 'mimes:jpeg,png,gif,webp', 'max:' . (config('app.upload_limit') * 1000)]; + return ['image_extension', 'mimes:jpeg,png,gif,webp,svg', 'max:' . (config('app.upload_limit') * 1000)]; } }