]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
[Embed] Fixed bug where sometimes images were written outside the site root
authorMiguel Dantas <biodantasgs@gmail.com>
Sun, 14 Jul 2019 22:56:31 +0000 (23:56 +0100)
committerDiogo Cordeiro <diogo@fc.up.pt>
Sat, 3 Aug 2019 16:49:09 +0000 (17:49 +0100)
plugins/Embed/EmbedPlugin.php

index 245914f2201c2684b3d9a82cc0c40dde438837c4..b7b4640cc55cfe67bce92fd525acb041a17b1731 100644 (file)
@@ -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);