forked from GNUsocial/gnu-social
Mimetype was not recognized if longer than bare mime
This commit is contained in:
parent
6938d26524
commit
945920f24d
@ -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)
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user