From d66828c2bf58f98cfc3338562453ea3992611fb5 Mon Sep 17 00:00:00 2001 From: Miguel Dantas Date: Sun, 14 Jul 2019 23:56:31 +0100 Subject: [PATCH] [Embed] Fixed bug where sometimes images were written outside the site root --- plugins/Embed/EmbedPlugin.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/Embed/EmbedPlugin.php b/plugins/Embed/EmbedPlugin.php index 245914f220..b7b4640cc5 100644 --- a/plugins/Embed/EmbedPlugin.php +++ b/plugins/Embed/EmbedPlugin.php @@ -451,6 +451,7 @@ class EmbedPlugin extends Plugin } $head = (new HTTPClient())->head($url); $headers = $head->getHeader(); + $headers = array_change_key_case($headers, CASE_LOWER); } return $headers['content-length'] ?: false; } catch (Exception $err) { @@ -475,6 +476,7 @@ class EmbedPlugin extends Plugin } $head = (new HTTPClient())->head($url); $headers = $head->getHeader(); + $headers = array_change_key_case($headers, CASE_LOWER); } return !empty($headers['content-type']) && common_get_mime_media($headers['content-type']) === 'image'; } @@ -498,6 +500,7 @@ class EmbedPlugin extends Plugin $head = (new HTTPClient())->head($url); $headers = $head->getHeader(); + $headers = array_change_key_case($headers, CASE_LOWER); try { $isImage = $this->isRemoteImage($url, $headers);