mirror of
https://github.com/moodle/moodle.git
synced 2025-04-22 00:42:54 +02:00
MDL-26028 fix invalid separator constant and support root dirs in aliases
Credit goes to Loic Jeannin, thanks.
This commit is contained in:
parent
f7d26a0545
commit
e61f888d36
@ -52,7 +52,14 @@ function xsendfile($filepath) {
|
||||
$aliased = false;
|
||||
if (!empty($CFG->xsendfilealiases) and is_array($CFG->xsendfilealiases)) {
|
||||
foreach ($CFG->xsendfilealiases as $alias=>$dir) {
|
||||
$dir = realpath($dir).PATH_SEPARATOR;
|
||||
$dir = realpath($dir);
|
||||
if ($dir === false) {
|
||||
continue;
|
||||
}
|
||||
if (substr($dir, -1) !== DIRECTORY_SEPARATOR) {
|
||||
// add trailing dir separator
|
||||
$dir .= DIRECTORY_SEPARATOR;
|
||||
}
|
||||
if (strpos($filepath, $dir) === 0) {
|
||||
$filepath = $alias.substr($filepath, strlen($dir));
|
||||
$aliased = true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user