Skip to content

Commit cfb55d2

Browse files
authored
Update index.php
- php execution timeout disabled - shell command "v-open-fs-file" is not suitable for large files. replaced with php readfile.
1 parent 5500f3c commit cfb55d2

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

web/download/file/index.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,20 @@
1313

1414
$path = $_REQUEST['path'];
1515
if (!empty($path)) {
16+
set_time_limit(0);
17+
if (ob_get_level()) {
18+
ob_end_clean();
19+
}
1620
header("Content-type: application/octet-stream");
1721
header("Content-Transfer-Encoding: binary");
1822
header("Content-disposition: attachment;filename=".basename($path));
19-
passthru(VESTA_CMD . "v-open-fs-file " . $user . " " . escapeshellarg($path));
23+
$output = '';
24+
exec(VESTA_CMD . "v-check-fs-permission " . $user . " " . escapeshellarg($path), $output, $return_var);
25+
if ($return_var != 0) {
26+
print 'Error while opening file'; // todo: handle this more styled
27+
exit;
28+
}
29+
readfile($path);
2030
exit;
2131
} else {
2232
die('File not found');

0 commit comments

Comments
 (0)