diff --git a/repository/filesystem/lib.php b/repository/filesystem/lib.php index a41e637ef34..1fa5e7c33e8 100644 --- a/repository/filesystem/lib.php +++ b/repository/filesystem/lib.php @@ -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; diff --git a/repository/googledocs/lib.php b/repository/googledocs/lib.php index 1ce0e1bdc15..bb76594708d 100644 --- a/repository/googledocs/lib.php +++ b/repository/googledocs/lib.php @@ -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); diff --git a/repository/onedrive/lib.php b/repository/onedrive/lib.php index 3e802124193..af810f4cb3a 100644 --- a/repository/onedrive/lib.php +++ b/repository/onedrive/lib.php @@ -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);