瀏覽代碼

cache_starred_images: set filename when sending cached image

Andrew Dolgov 8 年之前
父節點
當前提交
c203486e04
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      plugins/cache_starred_images/init.php

+ 3 - 1
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') &&