From 7aa473b8ef3c6e61a2ba83a40d6795568753a079 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Sun, 11 Aug 2024 09:16:36 -0400 Subject: [PATCH] Handle more than one level of output buffering when cleaning and ending them so we can send the video file so we don't run out of ram. Fixes #4110 --- web/skins/classic/views/video.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/web/skins/classic/views/video.php b/web/skins/classic/views/video.php index da363516f..eb6db3f41 100644 --- a/web/skins/classic/views/video.php +++ b/web/skins/classic/views/video.php @@ -78,8 +78,6 @@ if (isset($_REQUEST['deleteIndex'])) { unlink($videoFiles[$deleteIndex]); unset($videoFiles[$deleteIndex]); } else if (isset($_REQUEST['downloadIndex'])) { - // can't be output buffering, as this file might be large - ob_end_clean(); $downloadIndex = validInt($_REQUEST['downloadIndex']); ZM\Debug("Download $downloadIndex, file: " . $videoFiles[$downloadIndex]); header('Pragma: public'); @@ -91,6 +89,11 @@ if (isset($_REQUEST['deleteIndex'])) { header('Content-Transfer-Encoding: binary'); header('Content-Type: application/force-download'); header('Content-Length: '.filesize($videoFiles[$downloadIndex])); + // can't be output buffering, as this file might be large + while (ob_get_level()) { + ob_end_clean(); + } + set_time_limit(0); readfile($videoFiles[$downloadIndex]); exit; }