Skip to content

Commit 248625c

Browse files
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
1 parent 8a5d008 commit 248625c

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

web/skins/classic/views/video.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,7 @@
7777
$deleteIndex = validInt($_REQUEST['deleteIndex']);
7878
unlink($videoFiles[$deleteIndex]);
7979
unset($videoFiles[$deleteIndex]);
80-
}
81-
82-
if ( isset($_REQUEST['downloadIndex']) ) {
83-
// can't be output buffering, as this file might be large
84-
ob_end_clean();
80+
} else if (isset($_REQUEST['downloadIndex'])) {
8581
$downloadIndex = validInt($_REQUEST['downloadIndex']);
8682
ZM\Debug("Download $downloadIndex, file: " . $videoFiles[$downloadIndex]);
8783
header('Pragma: public');
@@ -93,6 +89,11 @@
9389
header('Content-Transfer-Encoding: binary');
9490
header('Content-Type: application/force-download');
9591
header('Content-Length: '.filesize($videoFiles[$downloadIndex]));
92+
// can't be output buffering, as this file might be large
93+
while (ob_get_level()) {
94+
ob_end_clean();
95+
}
96+
set_time_limit(0);
9697
readfile($videoFiles[$downloadIndex]);
9798
exit;
9899
}

0 commit comments

Comments
 (0)