From: Florent Bruneau Date: Wed, 19 Mar 2008 16:13:38 +0000 (+0100) Subject: Workaround buggy mime_content_type on php 5.2.0+etch10 (not tested on other version). X-Git-Tag: xorg/0.9.16~99 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=fa3300aa65242318a4874992da0747bfb3a50c77;p=platal.git 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 --- 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))); + } } }