MDL-83332 core: Revert the slashargument removal on MDL-62640

Removing the option causes issues on MacOS.
This commit is contained in:
meirzamoodle
2024-10-02 18:36:14 +07:00
parent 0eacab846e
commit 3229dda3d6
38 changed files with 833 additions and 549 deletions
+21 -7
View File
@@ -73,12 +73,20 @@ function file_encode_url($urlbase, $path, $forcedownload=false, $https=false) {
//TODO: deprecate this
$parts = explode('/', $path);
$parts = array_map('rawurlencode', $parts);
$path = implode('/', $parts);
$return = $urlbase . $path;
if ($forcedownload) {
$return .= '?forcedownload=1';
if ($CFG->slasharguments) {
$parts = explode('/', $path);
$parts = array_map('rawurlencode', $parts);
$path = implode('/', $parts);
$return = $urlbase.$path;
if ($forcedownload) {
$return .= '?forcedownload=1';
}
} else {
$path = rawurlencode($path);
$return = $urlbase.'?file='.$path;
if ($forcedownload) {
$return .= '&forcedownload=1';
}
}
if ($https) {
@@ -496,7 +504,13 @@ function file_rewrite_pluginfile_urls($text, $file, $contextid, $component, $fil
$finalfile = basename($file);
$tokenfile = "token{$finalfile}";
$file = substr($file, 0, strlen($file) - strlen($finalfile)) . $tokenfile;
$baseurl = "{$CFG->wwwroot}/{$file}/{$token}";
$baseurl = "{$CFG->wwwroot}/{$file}";
if (!$CFG->slasharguments) {
$baseurl .= "?token={$token}&file=";
} else {
$baseurl .= "/{$token}";
}
}
$baseurl .= "/{$contextid}/{$component}/{$filearea}/";