Skip to content

Commit 47bfb42

Browse files
Merge pull request hestiacp#508 from SysVoid/patch-5
Added file existence check.
2 parents 26b3b9e + 20675ac commit 47bfb42

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

bin/v-open-fs-file

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ if [ ! -z "$src_file" ]; then
3333
echo "Error: invalid source path $src_file"
3434
exit 2
3535
fi
36+
37+
if [ ! -f "$src_file" ]; then
38+
echo "Error: file not found $src_file"
39+
exit 2
40+
fi
3641
fi
3742

3843
# Reading file

web/download/file/index.php

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,16 @@
88

99
$user = $_SESSION['user'];
1010
if (($_SESSION['user'] == 'admin') && (!empty($_SESSION['look']))) {
11-
$user=$_SESSION['look'];
11+
$user = $_SESSION['look'];
1212
}
1313

14-
if (!empty($_REQUEST['path'])) {
15-
$path = $_REQUEST['path'];
14+
$path = $_REQUEST['path'];
15+
if (!empty($path)) {
1616
header("Content-type: application/octet-stream");
1717
header("Content-Transfer-Encoding: binary");
1818
header("Content-disposition: attachment;filename=".basename($path));
19-
passthru (VESTA_CMD . "v-open-fs-file " . $user . " " . escapeshellarg($path));
19+
passthru(VESTA_CMD . "v-open-fs-file " . $user . " " . escapeshellarg($path));
2020
exit;
21-
}
22-
else {
21+
} else {
2322
die('File not found');
2423
}
25-
26-
27-
?>

0 commit comments

Comments
 (0)