diff options
author | Jörn Friedrich Dreyer <jfd@butonic.de> | 2012-12-17 16:23:12 +0100 |
---|---|---|
committer | Jörn Friedrich Dreyer <jfd@butonic.de> | 2012-12-17 16:46:07 +0100 |
commit | b6eb95349e6e339c90f8165bcd0471bd6268f8c3 (patch) | |
tree | 2a3e7c235a7fe8baca9598d306246a93b51777b7 /apps/files/download.php | |
parent | 6861d4271508e96a27c4e9e2e7954ef90cfa8034 (diff) | |
download | nextcloud-server-b6eb95349e6e339c90f8165bcd0471bd6268f8c3.tar.gz nextcloud-server-b6eb95349e6e339c90f8165bcd0471bd6268f8c3.zip |
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
Diffstat (limited to 'apps/files/download.php')
-rw-r--r-- | apps/files/download.php | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/apps/files/download.php b/apps/files/download.php index 6475afb56e0..e2149cd4135 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)); |