Commit 945920f2 authored by mmn's avatar mmn

Mimetype was not recognized if longer than bare mime

parent 6938d265
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment