diff options
author | Craig Andrews <candrews@integralblue.com> | 2010-03-01 21:42:38 -0500 |
---|---|---|
committer | Craig Andrews <candrews@integralblue.com> | 2010-03-01 21:44:42 -0500 |
commit | a0114f20066fb50b5f8074bb00db0b398ff7899a (patch) | |
tree | 58e33820ce357233446a6afa91dc83218e4efbcf /classes/File.php | |
parent | d8212977ce7f911d4f9bd6e55f94aea059a86782 (diff) |
Correctly handle the case when MIME/Type doesn't know what file extension a mime type maps to
Diffstat (limited to 'classes/File.php')
-rw-r--r-- | classes/File.php | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/classes/File.php b/classes/File.php index 189e04ce0..79a7d6681 100644 --- a/classes/File.php +++ b/classes/File.php @@ -169,7 +169,11 @@ class File extends Memcached_DataObject { require_once 'MIME/Type/Extension.php'; $mte = new MIME_Type_Extension(); - $ext = $mte->getExtension($mimetype); + try { + $ext = $mte->getExtension($mimetype); + } catch ( Exception $e) { + $ext = strtolower(preg_replace('/\W/', '', $mimetype)); + } $nickname = $profile->nickname; $datestamp = strftime('%Y%m%dT%H%M%S', time()); $random = strtolower(common_confirmation_code(32)); |