forked from GNUsocial/gnu-social
Mimetypes like image/svg+xml were misinterpreted when guessing
We don't really need the mb_ in mb_strtolower but what the heck, why not. I love Unicode.
This commit is contained in:
parent
8c28e54ccc
commit
b696fb4eb1
@ -264,9 +264,13 @@ class File extends Managed_DataObject
|
|||||||
$ext = common_supported_mime_to_ext($mimetype);
|
$ext = common_supported_mime_to_ext($mimetype);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
// We don't support this mimetype, but let's guess the extension
|
// We don't support this mimetype, but let's guess the extension
|
||||||
$ext = substr(strrchr($mimetype, '/'), 1);
|
$matches = array();
|
||||||
|
if (!preg_match('/\/([a-z0-9]+)/', mb_strtolower($mimetype), $matches)) {
|
||||||
|
throw new Exception('Malformed mimetype: '.$mimetype);
|
||||||
}
|
}
|
||||||
return strtolower($ext);
|
$ext = $matches[1];
|
||||||
|
}
|
||||||
|
return mb_strtolower($ext);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user