Issue 10019: Fix embedding of media objects
[friendica.git/.git] / src / Content / Text / BBCode.php
index 9973705..0b49e75 100644 (file)
@@ -2257,10 +2257,10 @@ class BBCode
                        return $result;
                }
 
-               $siteinfo = ParseUrl::getSiteinfoCached($url);
+               $type = ParseUrl::getContentType($url);
 
-               if (in_array($siteinfo['type'], ['image', 'video', 'audio'])) {
-                       switch ($siteinfo['type']) {
+               if (in_array($type, ['image', 'video', 'audio'])) {
+                       switch ($type) {
                                case 'video':
                                        $bbcode = "\n" . '[video]' . $url . '[/video]' . "\n";
                                        break;
@@ -2275,6 +2275,8 @@ class BBCode
                        return $bbcode;
                }
 
+               $siteinfo = ParseUrl::getSiteinfoCached($url);
+
                unset($siteinfo['keywords']);
 
                // Bypass attachment if parse url for a comment