Added workaround for Android content disposition

Fixes #5807
This commit is contained in:
Vincent Petry 2013-12-10 12:40:59 +01:00
parent 409b510889
commit 82bf1f9c8c
1 changed files with 2 additions and 1 deletions

View File

@ -153,7 +153,8 @@ class OC_Response {
* @param string $type disposition type, either 'attachment' or 'inline'
*/
static public function setContentDispositionHeader( $filename, $type = 'attachment' ) {
if ( preg_match( "/MSIE/", $_SERVER["HTTP_USER_AGENT"] ) ) {
// Android Chrome user agent: https://developers.google.com/chrome/mobile/docs/user-agent
if ( preg_match( '/MSIE/', $_SERVER['HTTP_USER_AGENT'] ) or preg_match( '#Android.*Chrome/[.0-9]*#', $_SERVER['HTTP_USER_AGENT'] ) ) {
header( 'Content-Disposition: ' . rawurlencode($type) . '; filename="' . rawurlencode( $filename ) . '"' );
} else {
header( 'Content-Disposition: ' . rawurlencode($type) . '; filename*=UTF-8\'\'' . rawurlencode( $filename )