mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 21:49:15 +01:00
MDL-58823 repository: Fix redirections to external files
We cannot use redirect() because is not compatible with webservice/pluginfile.php This script is defined as an AJAX_SCRIPT so redirections are not allowed by redirect() function.
This commit is contained in:
parent
932bc91cb4
commit
fcdd7730bd
@ -845,7 +845,8 @@ function repository_filesystem_pluginfile($course, $cm, $context, $filearea, $ar
|
||||
// Find stored or generated thumbnail.
|
||||
if (!($file = $repo->get_thumbnail($filepath, $filearea))) {
|
||||
// Generation failed, redirect to default icon for file extension.
|
||||
redirect($OUTPUT->image_url(file_extension_icon($file, 90)));
|
||||
// Do not use redirect() here because is not compatible with webservice/pluginfile.php.
|
||||
header('Location: ' . $OUTPUT->image_url(file_extension_icon($file, 90)));
|
||||
}
|
||||
// The thumbnails should not be changing much, but maybe the default lifetime is too long.
|
||||
$lifetime = $CFG->filelifetime;
|
||||
|
@ -630,7 +630,8 @@ class repository_googledocs extends repository {
|
||||
}
|
||||
send_file($downloaded['path'], $filename, $lifetime, $filter, false, $forcedownload, '', false, $options);
|
||||
} else if ($source->link) {
|
||||
redirect($source->link);
|
||||
// Do not use redirect() here because is not compatible with webservice/pluginfile.php.
|
||||
header('Location: ' . $source->link);
|
||||
} else {
|
||||
$details = 'File is missing source link';
|
||||
throw new repository_exception('errorwhilecommunicatingwith', 'repository', '', $details);
|
||||
|
@ -577,7 +577,8 @@ class repository_onedrive extends repository {
|
||||
$filename = $storedfile->get_filename();
|
||||
send_file($downloaded['path'], $filename, $lifetime, $filter, false, $forcedownload, '', false, $options);
|
||||
} else if ($source->link) {
|
||||
redirect($source->link);
|
||||
// Do not use redirect() here because is not compatible with webservice/pluginfile.php.
|
||||
header('Location: ' . $source->link);
|
||||
} else {
|
||||
$details = 'File is missing source link';
|
||||
throw new repository_exception('errorwhilecommunicatingwith', 'repository', '', $details);
|
||||
|
Loading…
x
Reference in New Issue
Block a user