Ticket #1485449 (closed Patches: fixed)

Opened 3 months ago

Last modified 7 weeks ago

Can't display attachment with IE.

Reported by: dwj Owned by:
Priority: 5 Milestone: 0.2-stable
Component: Client Scripts Version: 0.2-beta
Severity: normal Keywords:
Cc: adamg@…

Description

I am using 0.2 beta svn version. It's all ok with Firefox, but can't display attachment(pdf/word/execl) files with IE.

I checked the code, it's send_nocacheing_headers() cause IE always delete the file after download completed.

Here is my code to fix the bug.

Modify program/include/rcube_shared.inc

function send_nocacheing_headers()
{
  if (headers_sent())
    return;

  if (strstr($_SERVER['HTTP_USER_AGENT'], “MSIE”))
  {
    header("Expires: 0");
    header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
    header("Content-Transfer-Encoding: binary");
    header("Pragma: public");
  }
  else
  {
    header("Cache-Control: private");
    header("Content-Transfer-Encoding: binary");
    header("Expires: 0");
    header("Pragma: no-cache");
  }
}

Change History

  Changed 3 months ago by tensor

  • milestone changed from later to 0.2-stable

Cannot reproduce this. I tested with .doc and .docx files with IR 7 on Windows XP SP3 fully patched.

Dwj, please provide more info. 1. Your distro and php version, version of Windows and version of IE (in Help->About). Are you using HTTPS? 2. Try to create a new user in Windows and try to reproduce the bug in fresh account, some IE settings may be at play.

Please provide a patch aginst the latest version in svn trunk.

  Changed 3 months ago by tensor

I really mean IE 7, not IR 7 :)

follow-up: ↓ 4   Changed 3 months ago by dwj

I run RC on ubuntu 8.04 with Apache 2.2.8, libapache2-mod-php 5.2.4, no https. Client is Windows XP SP3 fully patched with IE6.1 and IE7.

I tested to view a .pdf attachment file. IE7 says that it can't find the file after download completed.

Patch is here

--- rcube_shared.inc    2008-10-05 01:19:16.000000000 +0800
+++ rcube_shared.inc.new        2008-10-05 01:26:09.000000000 +0800
@@ -35,15 +35,19 @@
   if (headers_sent())
     return;

-  header("Expires: ".gmdate("D, d M Y H:i:s")." GMT");
-  header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
-  header("Cache-Control: private, no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
-  header("Pragma: no-cache");
-
-  // We need to set the following headers to make downloads work using IE in HTTPS mode.
-  if (isset($_SERVER['HTTPS'])) {
-    header('Pragma: ');
-    header('Cache-Control: ');
+  if (strstr($_SERVER['HTTP_USER_AGENT'], “MSIE”))
+  {
+    header("Expires: 0");
+    header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
+    header("Content-Transfer-Encoding: binary");
+    header("Pragma: public");
+  }
+  else
+  {
+    header("Cache-Control: private");
+    header("Content-Transfer-Encoding: binary");
+    header("Expires: 0");
+    header("Pragma: no-cache");
   }
 }

You can see the issue in comments of http://joseph.randomnetworks.com/archives/2004/10/01/making-ie-accept-file-downloads/

in reply to: ↑ 3 ; follow-up: ↓ 5   Changed 3 months ago by tensor

Replying to dwj:

I run RC on ubuntu 8.04 with Apache 2.2.8, libapache2-mod-php 5.2.4, no https. Client is Windows XP SP3 fully patched with IE6.1 and IE7.

Do you use something like multiIE?

in reply to: ↑ 4   Changed 3 months ago by dwj

Replying to tensor:

Replying to dwj:

I run RC on ubuntu 8.04 with Apache 2.2.8, libapache2-mod-php 5.2.4, no https. Client is Windows XP SP3 fully patched with IE6.1 and IE7.

Do you use something like multiIE?

No, I didn't use multiIE. My desktop pc is IE7 environment, and run XP SP3 IE6 on virtualbox for testing.

  Changed 3 months ago by tensor

Can you provide a test account on your server? You can send me private details to dennis at nikolaenko dot ru

  Changed 3 months ago by tensor

Please try the following patch:

=== program/steps/mail/get.inc
==================================================================
--- program/steps/mail/get.inc  (revision 2016)
+++ program/steps/mail/get.inc  (local)
@@ -89,7 +89,6 @@
       }
       
       $filename = $part->filename ? $part->filename : ($MESSAGE->subject ? $MESSAGE->subject : 'roundcube') . '.'.$ctype_secondary;
-      $filename = abbreviate_string($part->filename, 55);
       $filename = $browser->ie ? rawurlencode($filename) : addslashes($filename);
       $disposition = !empty($_GET['_download']) ? 'attachment' : 'inline';
       

  Changed 3 months ago by adamg

  • cc adamg@… added

I've run into the same issue, with Internet Explorer 6.5/7.0 PDF attachments weren't displayed, instead they resulted in an "Internet explorer cannot download" error message. With some help of git-svn, I've narrowed this down to changeset r1732, then down change to program/steps/mail/get.inc, and finally down to single line:

-    header("Cache-Control: must-revalidate, post-check=0, pre-check=0");

Turns out, when there's either "Cache-control: no-cache" or "Cache-Control: no-store" http header set, IE will fail to open PDF/DOC/XLS inline. There's an article available in Microsoft Knowledge Base: http://support.microsoft.com/kb/812935 that discusses this issue.

I've prepared simple one-liner that fixes current trunk (r1983 at the moment). Please apply the below patch:

--- roundcube.svn/program/include/rcube_shared.inc~     2008-10-13 07:37:09.000000000 +0200
+++ roundcube.svn/program/include/rcube_shared.inc      2008-10-16 20:00:01.000000000 +0200
@@ -37,7 +37,7 @@

   header("Expires: ".gmdate("D, d M Y H:i:s")." GMT");
   header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
-  header("Cache-Control: private, no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
+  header("Cache-Control: private, must-revalidate, post-check=0, pre-check=0");
   header("Pragma: no-cache");

   // We need to set the following headers to make downloads work using IE in HTTPS mode.

  Changed 7 weeks ago by thomasb

  • status changed from new to closed
  • resolution set to fixed

Last patch added in r2085. Does this solve the issue now? Please re-open if it's not solved with this.

Note: See TracTickets for help on using tickets.