From 09bd5bd517fee80e8b44b7645b51a8ba482a4d7c Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Thu, 12 Dec 2013 11:32:56 +0100 Subject: Added isUserAgent() method to request - added isUserAgent() method to OC_Request which makes it possible to test it - OC_Response::setContentDisposition now uses OC_Request::isUserAgent() --- lib/private/response.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'lib/private/response.php') diff --git a/lib/private/response.php b/lib/private/response.php index c6edda0f949..04746437347 100644 --- a/lib/private/response.php +++ b/lib/private/response.php @@ -153,8 +153,7 @@ class OC_Response { * @param string $type disposition type, either 'attachment' or 'inline' */ static public function setContentDispositionHeader( $filename, $type = 'attachment' ) { - // 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'] ) ) { + if (OC_Request::isUserAgent(array(OC_Request::USER_AGENT_IE, OC_Request::USER_AGENT_ANDROID_MOBILE_CHROME))) { header( 'Content-Disposition: ' . rawurlencode($type) . '; filename="' . rawurlencode( $filename ) . '"' ); } else { header( 'Content-Disposition: ' . rawurlencode($type) . '; filename*=UTF-8\'\'' . rawurlencode( $filename ) -- cgit v1.2.3