From: Mikael Nordfeldth Date: Sat, 5 Aug 2017 07:46:14 +0000 (+0200) Subject: Mimetype was not recognized if longer than bare mime X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=945920f24dba53d8367160b221bc842db0768fc4;p=quix0rs-gnu-social.git Mimetype was not recognized if longer than bare mime --- diff --git a/lib/util.php b/lib/util.php index b67df923d9..d1d79d1282 100644 --- a/lib/util.php +++ b/lib/util.php @@ -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) diff --git a/plugins/LRDD/lib/discovery.php b/plugins/LRDD/lib/discovery.php index a69d5b8ce2..5a1ec7969a 100644 --- a/plugins/LRDD/lib/discovery.php +++ b/plugins/LRDD/lib/discovery.php @@ -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);