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

pull/4113/head
Isaac Connor 2024-08-11 09:16:36 -04:00
parent c294ad09ff
commit 7aa473b8ef
1 changed files with 5 additions and 2 deletions

View File

@ -78,8 +78,6 @@ if (isset($_REQUEST['deleteIndex'])) {
unlink($videoFiles[$deleteIndex]); unlink($videoFiles[$deleteIndex]);
unset($videoFiles[$deleteIndex]); unset($videoFiles[$deleteIndex]);
} else if (isset($_REQUEST['downloadIndex'])) { } else if (isset($_REQUEST['downloadIndex'])) {
// can't be output buffering, as this file might be large
ob_end_clean();
$downloadIndex = validInt($_REQUEST['downloadIndex']); $downloadIndex = validInt($_REQUEST['downloadIndex']);
ZM\Debug("Download $downloadIndex, file: " . $videoFiles[$downloadIndex]); ZM\Debug("Download $downloadIndex, file: " . $videoFiles[$downloadIndex]);
header('Pragma: public'); header('Pragma: public');
@ -91,6 +89,11 @@ if (isset($_REQUEST['deleteIndex'])) {
header('Content-Transfer-Encoding: binary'); header('Content-Transfer-Encoding: binary');
header('Content-Type: application/force-download'); header('Content-Type: application/force-download');
header('Content-Length: '.filesize($videoFiles[$downloadIndex])); 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]); readfile($videoFiles[$downloadIndex]);
exit; exit;
} }