From: Miguel Dantas Date: Sun, 14 Jul 2019 22:56:31 +0000 (+0100) Subject: [Embed] Fixed bug where sometimes images were written outside the site root X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=d66828c2bf58f98cfc3338562453ea3992611fb5;p=quix0rs-gnu-social.git [Embed] Fixed bug where sometimes images were written outside the site root --- 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);