[Pkg-owncloud-commits] [owncloud] 237/394: fix utf8 filenames in ie download response header according to rfc5987, see http://stackoverflow.com/questions/93551/how-to-encode-the-filename-parameter-of-content-disposition-header-in-http
David Prévot
taffit at alioth.debian.org
Fri Nov 8 23:12:14 UTC 2013
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to annotated tag v4.5.10
in repository owncloud.
commit e02e218a5aac3b17c41b1820139dcf6efd03e44e
Author: Jörn Friedrich Dreyer <jfd at butonic.de>
Date: Mon Dec 17 16:23:12 2012 +0100
fix utf8 filenames in ie download response header according to rfc5987, see http://stackoverflow.com/questions/93551/how-to-encode-the-filename-parameter-of-content-disposition-header-in-http
---
apps/files/download.php | 7 ++++++-
lib/files.php | 7 ++++++-
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/apps/files/download.php b/apps/files/download.php
index ff6aefb..975ffb0 100644
--- a/apps/files/download.php
+++ b/apps/files/download.php
@@ -40,7 +40,12 @@ if(!OC_Filesystem::file_exists($filename)) {
$ftype=OC_Filesystem::getMimeType( $filename );
header('Content-Type:'.$ftype);
-header('Content-Disposition: attachment; filename="'.basename($filename).'"');
+if ( preg_match( "/MSIE/", $_SERVER["HTTP_USER_AGENT"] ) ) {
+ header( 'Content-Disposition: attachment; filename="' . rawurlencode( basename($filename) ) . '"' );
+} else {
+ header( 'Content-Disposition: attachment; filename*=UTF-8\'\'' . rawurlencode( basename($filename) )
+ . '; filename="' . rawurlencode( basename($filename) ) . '"' );
+}
OCP\Response::disableCaching();
header('Content-Length: '.OC_Filesystem::filesize($filename));
diff --git a/lib/files.php b/lib/files.php
index d96e9df..a4dbddc 100644
--- a/lib/files.php
+++ b/lib/files.php
@@ -184,7 +184,12 @@ class OC_Files {
}
@ob_end_clean();
if($zip or OC_Filesystem::is_readable($filename)) {
- header('Content-Disposition: attachment; filename="'.basename($filename).'"');
+ if ( preg_match( "/MSIE/", $_SERVER["HTTP_USER_AGENT"] ) ) {
+ header( 'Content-Disposition: attachment; filename="' . rawurlencode( basename($filename) ) . '"' );
+ } else {
+ header( 'Content-Disposition: attachment; filename*=UTF-8\'\'' . rawurlencode( basename($filename) )
+ . '; filename="' . rawurlencode( basename($filename) ) . '"' );
+ }
header('Content-Transfer-Encoding: binary');
OC_Response::disableCaching();
if($zip) {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list