]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Mimetype was not recognized if longer than bare mime
authorMikael Nordfeldth <mmn@hethane.se>
Sat, 5 Aug 2017 07:46:14 +0000 (09:46 +0200)
committerMikael Nordfeldth <mmn@hethane.se>
Sat, 5 Aug 2017 07:50:42 +0000 (09:50 +0200)
lib/util.php
plugins/LRDD/lib/discovery.php

index b67df923d915ceb025a4994cad0290551c89ec01..d1d79d1282d566178d25c2c3bc9caed0b54815ac 100644 (file)
@@ -2060,7 +2060,7 @@ function common_bare_mime($mimetype)
     if ($semicolon = mb_strpos($mimetype, ';')) {
         $mimetype = mb_substr($mimetype, 0, $semicolon);
     }
-    return $mimetype;
+    return trim($mimetype);
 }
 
 function common_mime_type_match($type, $avail)
index a69d5b8ce214b433403e6793d4e85d2e35051f1c..5a1ec7969acf2db4dd6582e8da0b713a408f83a8 100644 (file)
@@ -124,7 +124,7 @@ class Discovery
                     throw new Exception('Unexpected HTTP status code.');
                 }
 
-                switch ($response->getHeader('content-type')) {
+                switch (common_bare_mime($response->getHeader('content-type'))) {
                 case self::JRD_MIMETYPE_OLD:
                 case self::JRD_MIMETYPE:
                     $type = 'json';
@@ -134,7 +134,7 @@ class Discovery
                     break;
                 default:
                     // fall back to letting XML_XRD auto-detect
-                    common_debug('No recognized content-type header for resource descriptor body.');
+                    common_debug('No recognized content-type header for resource descriptor body on '._ve($xrd_uri));
                     $type = null;
                 }
                 $xrd->loadString($response->getBody(), $type);