From 6573332f7e238f0ac86989d45a2805cbc1745d1e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tobias=20H=C3=B6=C3=9Fl?= Date: Sun, 10 Jun 2012 09:35:32 +0000 Subject: [PATCH] Do not try to cache data:-URLs; Remove Pragma-Headers in order to allow caching --- privacy_image_cache/privacy_image_cache.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/privacy_image_cache/privacy_image_cache.php b/privacy_image_cache/privacy_image_cache.php index f179a7ba..d3202c4d 100644 --- a/privacy_image_cache/privacy_image_cache.php +++ b/privacy_image_cache/privacy_image_cache.php @@ -30,7 +30,12 @@ function privacy_image_cache_module() {} function privacy_image_cache_init() { - $urlhash = 'pic:' . sha1($_REQUEST['url']); + if(function_exists('header_remove')) { + header_remove('Pragma'); + header_remove('pragma'); + } + + $urlhash = 'pic:' . sha1($_REQUEST['url']); $r = q("SELECT * FROM `photo` WHERE `resource-id` = '%s' LIMIT 1", $urlhash ); if (count($r)) { $img_str = $r[0]['data']; @@ -90,6 +95,8 @@ function privacy_image_cache_init() { */ function privacy_image_cache_is_local_image($url) { if ($url[0] == '/') return true; + if (strtolower(substr($url, 0, 5)) == "data:") return true; + // links normalised - bug #431 $baseurl = normalise_link(get_app()->get_baseurl()); $url = normalise_link($url); -- 2.39.5