diff options
author | Andrew Dolgov <[email protected]> | 2020-09-15 07:54:46 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2020-09-15 07:54:46 +0300 |
commit | 1ee458b5c1cdaf254dccadee77bb77b421b0fd45 (patch) | |
tree | e8d6d21b12d4b92c68500d98e5c3220cf7e77442 | |
parent | 0758397dd898e6cd42b607304e23c9298fad11ec (diff) |
cached_url: perform mimetype validation before possible HOOK_SEND_LOCAL_FILE hooks
-rw-r--r-- | include/functions.php | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/include/functions.php b/include/functions.php index 220a8e9d8..fe6dc3934 100644 --- a/include/functions.php +++ b/include/functions.php @@ -1811,15 +1811,6 @@ if (is_writable($filename)) touch($filename); - $tmppluginhost = new PluginHost(); - - $tmppluginhost->load(PLUGINS, PluginHost::KIND_SYSTEM); - $tmppluginhost->load_data(); - - foreach ($tmppluginhost->get_hooks(PluginHost::HOOK_SEND_LOCAL_FILE) as $plugin) { - if ($plugin->hook_send_local_file($filename)) return true; - } - $mimetype = mime_content_type($filename); // this is hardly ideal but 1) only media is cached in images/ and 2) seemingly only mp4 @@ -1837,6 +1828,15 @@ return false; } + $tmppluginhost = new PluginHost(); + + $tmppluginhost->load(PLUGINS, PluginHost::KIND_SYSTEM); + $tmppluginhost->load_data(); + + foreach ($tmppluginhost->get_hooks(PluginHost::HOOK_SEND_LOCAL_FILE) as $plugin) { + if ($plugin->hook_send_local_file($filename)) return true; + } + header("Content-type: $mimetype"); $stamp = gmdate("D, d M Y H:i:s", filemtime($filename)) . " GMT"; |