From c6ae5fbda1b0945e585b2f75fac5b673dbf02728 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 14 Aug 2019 10:01:05 +0300 Subject: [PATCH] af_zz_imgproxy: redirect to cached_url if cache already exists so that urls are a bit shorter (2) --- plugins/af_zz_imgproxy/init.php | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/plugins/af_zz_imgproxy/init.php b/plugins/af_zz_imgproxy/init.php index 754de12e1..319fccee8 100755 --- a/plugins/af_zz_imgproxy/init.php +++ b/plugins/af_zz_imgproxy/init.php @@ -124,22 +124,22 @@ class Af_Zz_ImgProxy extends Plugin { if (($scheme != 'https' && $scheme != "") || $is_remote) { if (strpos($url, "data:") !== 0) { - $parts = parse_url($url); - - foreach (explode(" " , $this->ssl_known_whitelist) as $host) { - if (substr(strtolower($parts['host']), -strlen($host)) === strtolower($host)) { - $parts['scheme'] = 'https'; - $url = build_url($parts); - if ($all_remote && $is_remote) { - break; - } else { - return $url; - } - } - } - /* we don't need to handle URLs where local cache already exists, tt-rss rewrites those automatically */ if (!$this->cache->exists(sha1($url))) { + $parts = parse_url($url); + + foreach (explode(" " , $this->ssl_known_whitelist) as $host) { + if (substr(strtolower($parts['host']), -strlen($host)) === strtolower($host)) { + $parts['scheme'] = 'https'; + $url = build_url($parts); + if ($all_remote && $is_remote) { + break; + } else { + return $url; + } + } + } + return get_self_url_prefix() . "/public.php?op=pluginhandler&plugin=af_zz_imgproxy&pmethod=imgproxy&url=" . urlencode($url); }