]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Correctly handle the case when MIME/Type doesn't know what file extension a mime...
authorCraig Andrews <candrews@integralblue.com>
Tue, 2 Mar 2010 02:42:38 +0000 (21:42 -0500)
committerCraig Andrews <candrews@integralblue.com>
Tue, 2 Mar 2010 02:44:42 +0000 (21:44 -0500)
classes/File.php

index 189e04ce021d77dc74a29ee14dbb64df118b4c2e..79a7d6681334e881144a3194fe567ea8a2ae3201 100644 (file)
@@ -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));