From c7ff6ec2cb985061438e5b68cfc5691b5a86422c Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Wed, 05 Dec 2012 03:46:03 -0500
Subject: [PATCH] Add workaround for IE<=8 bug where Content-Disposition:inline was ignored (#1488844)

---
 CHANGELOG                  |    1 +
 program/steps/mail/get.inc |    7 +++++++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index af7d29c..5a1b1ac 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
 CHANGELOG Roundcube Webmail
 ===========================
 
+- Add workaround for IE<=8 bug where Content-Disposition:inline was ignored (#1488844)
 - Fix XSS vulnerability in vbscript: and data:text links handling (#1488850)
 - Fix broken message/part bodies when FETCH response contains more untagged lines (#1488836)
 - Fix empty email on identities list after identity update (#1488834)
diff --git a/program/steps/mail/get.inc b/program/steps/mail/get.inc
index 7b2f719..7f06feb 100644
--- a/program/steps/mail/get.inc
+++ b/program/steps/mail/get.inc
@@ -259,6 +259,13 @@
 
       $disposition = !empty($plugin['download']) ? 'attachment' : 'inline';
 
+      // Workaround for nasty IE bug (#1488844)
+      // If Content-Disposition header contains string "attachment" e.g. in filename
+      // IE handles data as attachment not inline
+      if ($disposition == 'inline' && $browser->ie && $browser->ver < 9) {
+        $filename = str_ireplace('attachment', 'attach', $filename);
+      }
+
       header("Content-Disposition: $disposition; filename=\"$filename\"");
 
       // handle tiff to jpeg conversion

--
Gitblit v1.9.1