diff options
-rwxr-xr-x | lib/private/request.php | 1 | ||||
-rw-r--r-- | lib/private/response.php | 6 | ||||
-rw-r--r-- | tests/lib/request.php | 15 |
3 files changed, 21 insertions, 1 deletions
diff --git a/lib/private/request.php b/lib/private/request.php index d9d5ae08e28..2c5b907846e 100755 --- a/lib/private/request.php +++ b/lib/private/request.php @@ -11,6 +11,7 @@ class OC_Request { const USER_AGENT_IE = '/MSIE/'; // Android Chrome user agent: https://developers.google.com/chrome/mobile/docs/user-agent const USER_AGENT_ANDROID_MOBILE_CHROME = '#Android.*Chrome/[.0-9]*#'; + const USER_AGENT_FREEBOX = '#^Mozilla/5\.0$#'; /** * @brief Check overwrite condition diff --git a/lib/private/response.php b/lib/private/response.php index 04746437347..52dbb9d90f8 100644 --- a/lib/private/response.php +++ b/lib/private/response.php @@ -153,7 +153,11 @@ class OC_Response { * @param string $type disposition type, either 'attachment' or 'inline' */ static public function setContentDispositionHeader( $filename, $type = 'attachment' ) { - if (OC_Request::isUserAgent(array(OC_Request::USER_AGENT_IE, OC_Request::USER_AGENT_ANDROID_MOBILE_CHROME))) { + if (OC_Request::isUserAgent(array( + OC_Request::USER_AGENT_IE, + OC_Request::USER_AGENT_ANDROID_MOBILE_CHROME, + OC_Request::USER_AGENT_FREEBOX + ))) { header( 'Content-Disposition: ' . rawurlencode($type) . '; filename="' . rawurlencode( $filename ) . '"' ); } else { header( 'Content-Disposition: ' . rawurlencode($type) . '; filename*=UTF-8\'\'' . rawurlencode( $filename ) diff --git a/tests/lib/request.php b/tests/lib/request.php index c6401a57144..1d77acc70ae 100644 --- a/tests/lib/request.php +++ b/tests/lib/request.php @@ -118,6 +118,21 @@ class Test_Request extends PHPUnit_Framework_TestCase { ), true ), + array( + 'Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Firefox/24.0', + OC_Request::USER_AGENT_FREEBOX, + false + ), + array( + 'Mozilla/5.0', + OC_Request::USER_AGENT_FREEBOX, + true + ), + array( + 'Fake Mozilla/5.0', + OC_Request::USER_AGENT_FREEBOX, + false + ), ); } } |