Opened 5 years ago
Closed 5 years ago
#1485449 closed Feature Patches (fixed)
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 (9)
comment:1 Changed 5 years ago by tensor
- Milestone changed from later to 0.2-stable
comment:2 Changed 5 years ago by tensor
I really mean IE 7, not IR 7 :)
comment:3 follow-up: ↓ 4 Changed 5 years 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/
comment:4 in reply to: ↑ 3 ; follow-up: ↓ 5 Changed 5 years 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?
comment:5 in reply to: ↑ 4 Changed 5 years 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.
comment:6 Changed 5 years ago by tensor
Can you provide a test account on your server?
You can send me private details to dennis at nikolaenko dot ru
comment:7 Changed 5 years 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';
comment:8 Changed 5 years 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 [0dbac321], 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 ([b685e9e4] 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.
comment:9 Changed 5 years ago by thomasb
- Resolution set to fixed
- Status changed from new to closed
Last patch added in [456c7e40]. Does this solve the issue now? Please re-open if it's not solved with this.

Cannot reproduce this.
I tested with .doc and .docx files with IR 7 on Windows XP SP3 fully patched.
Dwj, please provide more info.
Please provide a patch aginst the latest version in svn trunk.