From fa3300aa65242318a4874992da0747bfb3a50c77 Mon Sep 17 00:00:00 2001 From: Florent Bruneau Date: Wed, 19 Mar 2008 17:13:38 +0100 Subject: [PATCH] Workaround buggy mime_content_type on php 5.2.0+etch10 (not tested on other version). 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 --- ChangeLog | 5 +++-- classes/plupload.php | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0313ea2..d9c720e 100644 --- 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 diff --git a/classes/plupload.php b/classes/plupload.php index 155a8a4..1911ab9 100644 --- a/classes/plupload.php +++ b/classes/plupload.php @@ -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))); + } } } -- 2.1.4