From 82bf1f9c8ccbfed39790d22b2fbea2c5286122dc Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Tue, 10 Dec 2013 12:40:59 +0100 Subject: [PATCH] Added workaround for Android content disposition Fixes #5807 --- lib/private/response.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/private/response.php b/lib/private/response.php index 1b9cb473d6..c6edda0f94 100644 --- a/lib/private/response.php +++ b/lib/private/response.php @@ -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 )