]> source.dussan.org Git - nextcloud-server.git/commitdiff
Added workaround for Android content disposition
authorVincent Petry <pvince81@owncloud.com>
Tue, 10 Dec 2013 11:40:59 +0000 (12:40 +0100)
committerVincent Petry <pvince81@owncloud.com>
Tue, 10 Dec 2013 11:42:41 +0000 (12:42 +0100)
Fixes #5807

lib/private/response.php

index 1b9cb473d67a12eba0f0ab4f98d4b171d692ad02..c6edda0f949a5ad07f0408077e09bb919c0bc5f0 100644 (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 )