summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2015-10-06 14:58:07 +0200
committerMorris Jobke <hey@morrisjobke.de>2015-10-09 11:19:06 +0200
commitbf579a153f8f0d6fb081a1d11718ea48c779da34 (patch)
tree0dff2c0947f8cc14bdf5ca8908355cd4c70e133c
parentc7aef6c36833b1d9bdec9dc30ceb874b8cb93019 (diff)
downloadnextcloud-server-bf579a153f8f0d6fb081a1d11718ea48c779da34.tar.gz
nextcloud-server-bf579a153f8f0d6fb081a1d11718ea48c779da34.zip
fix IE8 user agent detection
-rw-r--r--core/avatar/avatarcontroller.php2
-rw-r--r--lib/private/appframework/http/request.php1
-rw-r--r--lib/public/util.php14
-rw-r--r--settings/controller/certificatecontroller.php2
4 files changed, 3 insertions, 16 deletions
diff --git a/core/avatar/avatarcontroller.php b/core/avatar/avatarcontroller.php
index 1604ecf79d1..eb2cb657104 100644
--- a/core/avatar/avatarcontroller.php
+++ b/core/avatar/avatarcontroller.php
@@ -141,7 +141,7 @@ class AvatarController extends Controller {
$files = $this->request->getUploadedFile('files');
$headers = [];
- if (\OCP\Util::isIE8()) {
+ if (\OC::$server->getRequest()->isUserAgent([\OC\AppFramework\Http\Request::USER_AGENT_IE_8])) {
// due to upload iframe workaround, need to set content-type to text/plain
$headers['Content-Type'] = 'text/plain';
}
diff --git a/lib/private/appframework/http/request.php b/lib/private/appframework/http/request.php
index 3e24eec37c8..77785135162 100644
--- a/lib/private/appframework/http/request.php
+++ b/lib/private/appframework/http/request.php
@@ -43,6 +43,7 @@ use OCP\Security\ISecureRandom;
class Request implements \ArrayAccess, \Countable, IRequest {
const USER_AGENT_IE = '/MSIE/';
+ const USER_AGENT_IE_8 = '/MSIE 8.0/';
// 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$#';
diff --git a/lib/public/util.php b/lib/public/util.php
index 2b81b6bfc49..76b61347d46 100644
--- a/lib/public/util.php
+++ b/lib/public/util.php
@@ -670,18 +670,4 @@ class Util {
}
return self::$needUpgradeCache;
}
-
- /**
- * Returns whether the current request is coming from a
- * famous awfully old browser.
- *
- * @return boolean true if it's IE8, false otherwise
- */
- public static function isIE8() {
- preg_match('/MSIE (.*?);/', $_SERVER['HTTP_USER_AGENT'], $matches);
- if (count($matches) > 0 && $matches[1] <= 9) {
- return true;
- }
- return false;
- }
}
diff --git a/settings/controller/certificatecontroller.php b/settings/controller/certificatecontroller.php
index b7bc81920c2..ef14ff3d9d9 100644
--- a/settings/controller/certificatecontroller.php
+++ b/settings/controller/certificatecontroller.php
@@ -69,7 +69,7 @@ class CertificateController extends Controller {
*/
public function addPersonalRootCertificate() {
$headers = [];
- if (\OCP\Util::isIE8()) {
+ if (\OC::$server->getRequest()->isUserAgent([\OC\AppFramework\Http\Request::USER_AGENT_IE_8])) {
// due to upload iframe workaround, need to set content-type to text/plain
$headers['Content-Type'] = 'text/plain';
}