Merge pull request #929 from owncloud/fix_utf8_filenames_in_ie_download

fix utf8 filenames in ie download response header according to rfc5987, ...
This commit is contained in:
Thomas Müller 2012-12-17 14:53:15 -08:00
commit b8f749420b
2 changed files with 12 additions and 2 deletions

View File

@ -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));

View File

@ -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) {