Workaround buggy mime_content_type on php 5.2.0+etch10 (not tested on other version).
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Wed, 19 Mar 2008 16:13:38 +0000 (17:13 +0100)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Wed, 19 Mar 2008 16:13:38 +0000 (17:13 +0100)
In this version, mime_content_type as a fallback to text/plain instead of
application/octet-stream, leading to invalid email attachments (Closes #802).

Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
ChangeLog
classes/plupload.php

index 0313ea2..d9c720e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -19,13 +19,14 @@ New:
         - Unsure mails are moderated                                       -FRU
 
     * Forums:
-       - Ban system                                                       -THD
-       
+        - Ban system                                                       -THD
+
 Bug/Wish:
 
     * Emails:
         - #726: Don't send the email if an attachment can't be downloaded  -FRU
         - #750: Fix email list in test email                               -FRU
+        - #802: Fix upload content type checking on some buggy PHP         -FRU
 
     * Lists:
         - #793: Show broken members on ML                                  -FRU
index 155a8a4..1911ab9 100644 (file)
@@ -66,6 +66,9 @@ class PlUpload
     {
         if ($this->exists()) {
             $this->type = trim(mime_content_type($this->filename));
+            if ($this->type == 'text/plain') { // Workaround a bug of php 5.2.0+etch10 (mime_content_type fallback is 'text/plain')
+                $this->type = trim(exec("file -bi " . escapeshellarg($this->filename)));
+            }
         }
     }