From c203486e040831881fd91db2cc3d8105214fa568 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 6 Jan 2016 21:00:53 +0300 Subject: [PATCH] cache_starred_images: set filename when sending cached image --- plugins/cache_starred_images/init.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/cache_starred_images/init.php b/plugins/cache_starred_images/init.php index f1341a350..63637bfd8 100644 --- a/plugins/cache_starred_images/init.php +++ b/plugins/cache_starred_images/init.php @@ -59,10 +59,12 @@ class Cache_Starred_Images extends Plugin implements IHandler { if ($hash) { - $filename = $this->cache_dir . "/" . $hash; + $filename = $this->cache_dir . "/" . basename($hash); $is_video = strpos($filename, ".mp4") !== FALSE; if (file_exists($filename)) { + header("Content-Disposition: attachment; filename=\"$hash\""); + /* See if we can use X-Sendfile */ $xsendfile = false; if (function_exists('apache_get_modules') &&