projects
/
quix0rs-gnu-social.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d821297
)
Correctly handle the case when MIME/Type doesn't know what file extension a mime...
author
Craig Andrews
<candrews@integralblue.com>
Tue, 2 Mar 2010 02:42:38 +0000
(21:42 -0500)
committer
Craig Andrews
<candrews@integralblue.com>
Tue, 2 Mar 2010 02:44:42 +0000
(21:44 -0500)
classes/File.php
patch
|
blob
|
history
diff --git
a/classes/File.php
b/classes/File.php
index 189e04ce021d77dc74a29ee14dbb64df118b4c2e..79a7d6681334e881144a3194fe567ea8a2ae3201 100644
(file)
--- 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));