diff --git a/lib/filelib.php b/lib/filelib.php index 98c487b36b3..d8161d0461b 100644 --- a/lib/filelib.php +++ b/lib/filelib.php @@ -2609,8 +2609,8 @@ function send_file($path, $filename, $lifetime = null , $filter=0, $pathisstring header('Cache-Control: private, max-age=10, no-transform'); header('Expires: '. gmdate('D, d M Y H:i:s', 0) .' GMT'); header('Pragma: '); - } else { //normal http - prevent caching at all cost - header('Cache-Control: private, must-revalidate, pre-check=0, post-check=0, max-age=0, no-transform'); + } else { // Normal http - prevent caching at all cost. + header('Cache-Control: private, must-revalidate, pre-check=0, post-check=0, max-age=0, no-transform', 'no-store'); header('Expires: '. gmdate('D, d M Y H:i:s', 0) .' GMT'); header('Pragma: no-cache'); } diff --git a/repository/filesystem/lib.php b/repository/filesystem/lib.php index c0c62ccac1f..ac0cf1ae8bd 100644 --- a/repository/filesystem/lib.php +++ b/repository/filesystem/lib.php @@ -622,6 +622,8 @@ class repository_filesystem extends repository { $filename = $options['filename']; } $dontdie = ($options && isset($options['dontdie'])); + // If the file is linked to the original then we should not cache it. + $lifetime = 0; send_file($file, $filename, $lifetime , $filter, false, $forcedownload, '', $dontdie); } else { send_file_not_found(); diff --git a/repository/user/lib.php b/repository/user/lib.php index 6ae186123af..6b25e60cc20 100644 --- a/repository/user/lib.php +++ b/repository/user/lib.php @@ -167,4 +167,12 @@ class repository_user extends repository { public function contains_private_data() { return false; } + + #[\Override] + public function send_file($storedfile, $lifetime=null , $filter=0, $forcedownload=false, ?array $options = null) { + // If the file is linked to the original then we should not cache it. + $lifetime = 0; + + parent::send_file($storedfile, $lifetime, $filter, $forcedownload, $options); + } }