We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit b696fb4e authored by mattl's avatar mattl

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.
parent 8c28e54c
......@@ -264,9 +264,13 @@ class File extends Managed_DataObject
$ext = common_supported_mime_to_ext($mimetype);
} catch (Exception $e) {
// 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);
$ext = $matches[1];
return strtolower($ext);
return mb_strtolower($ext);
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