From 868c9071bcc3166da11a078c19efcfbcf0036450 Mon Sep 17 00:00:00 2001 From: Tim Zimmermann Date: Tue, 19 Dec 2023 08:03:56 +0100 Subject: [PATCH] Only proxy non-https images * e.g imgur blocks hetzner IPs with HTTP/429, but already is https anyway --- src/FormatImages.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/FormatImages.php b/src/FormatImages.php index 29e45ab..dbc4275 100644 --- a/src/FormatImages.php +++ b/src/FormatImages.php @@ -45,7 +45,9 @@ public function __invoke(Renderer $renderer, $context, string $xml) { if ((bool) $this->settings->get('fof-secure-https.proxy')) { $xml = Utils::replaceAttributes($xml, 'IMG', function ($attributes) { - $attributes['src'] = $this->url->to('api')->route('fof.secure-https.imgurl').'?imgurl='.urlencode($attributes['src']); + if (!preg_match('/^https:\/\//', $attributes['src'])) { + $attributes['src'] = $this->url->to('api')->route('fof.secure-https.imgurl').'?imgurl='.urlencode($attributes['src']); + } return $attributes; });