From: Vincent Petry Date: Tue, 10 Dec 2013 11:40:59 +0000 (+0100) Subject: Added workaround for Android content disposition X-Git-Tag: v7.0.0alpha2~963^2~1 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=82bf1f9c8ccbfed39790d22b2fbea2c5286122dc;p=nextcloud-server.git Added workaround for Android content disposition Fixes #5807 --- diff --git a/lib/private/response.php b/lib/private/response.php index 1b9cb473d67..c6edda0f949 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 )