From 2f65797837ef84ab0307f04cf92bb87b1b044e51 Mon Sep 17 00:00:00 2001 From: Petr Skoda Date: Mon, 18 Oct 2010 11:39:57 +0000 Subject: [PATCH] do not send stored file if nothing to send given --- lib/filelib.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/filelib.php b/lib/filelib.php index 7c4c8dec05e..2cfa78914d3 100644 --- a/lib/filelib.php +++ b/lib/filelib.php @@ -1783,6 +1783,14 @@ function send_file($path, $filename, $lifetime = 'default' , $filter=0, $pathiss function send_stored_file($stored_file, $lifetime=86400 , $filter=0, $forcedownload=false, $filename=null, $dontdie=false) { global $CFG, $COURSE, $SESSION; + if (!$stored_file or $stored_file->is_directory()) { + // nothing to serve + if ($dontdie) { + return; + } + die; + } + if ($dontdie) { ignore_user_abort(true); }