summaryrefslogtreecommitdiff
path: root/classes/File.php
diff options
context:
space:
mode:
Diffstat (limited to 'classes/File.php')
-rw-r--r--classes/File.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/classes/File.php b/classes/File.php
index 1b8ef1b3e..4ecd3b959 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));