Skip to content
Snippets Groups Projects
Commit b8f74942 authored by Thomas Müller's avatar Thomas Müller
Browse files

Merge pull request #929 from owncloud/fix_utf8_filenames_in_ie_download

fix utf8 filenames in ie download response header according to rfc5987, ...
parents d085fdf8 b6eb9534
No related branches found
No related tags found
No related merge requests found
......@@ -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));
......
......@@ -197,7 +197,12 @@ class OC_Files {
}
OC_Util::obEnd();
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) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment