diff options
author | Lukas Reschke <lukas@owncloud.com> | 2016-03-24 14:59:47 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2016-03-24 19:02:16 +0100 |
commit | 95820fbd5b7a5d8241061ad30d5bf6c4fc8613d7 (patch) | |
tree | 773d7214c61cd80bdc0cca9eb659e157bfed2888 | |
parent | c46f480031856408eed09ee638da10fa495c7dad (diff) | |
download | nextcloud-server-95820fbd5b7a5d8241061ad30d5bf6c4fc8613d7.tar.gz nextcloud-server-95820fbd5b7a5d8241061ad30d5bf6c4fc8613d7.zip |
Add magical regex to catch browsers
-rw-r--r-- | apps/dav/lib/files/browsererrorpageplugin.php | 8 | ||||
-rw-r--r-- | lib/private/appframework/http/request.php | 8 |
2 files changed, 15 insertions, 1 deletions
diff --git a/apps/dav/lib/files/browsererrorpageplugin.php b/apps/dav/lib/files/browsererrorpageplugin.php index 12910955847..37a4166efef 100644 --- a/apps/dav/lib/files/browsererrorpageplugin.php +++ b/apps/dav/lib/files/browsererrorpageplugin.php @@ -57,7 +57,13 @@ class BrowserErrorPagePlugin extends ServerPlugin { if ($request->getMethod() !== 'GET') { return false; } - return $request->isUserAgent([Request::USER_AGENT_IE_8]); + return $request->isUserAgent([ + Request::USER_AGENT_IE, + Request::USER_AGENT_MS_EDGE, + Request::USER_AGENT_CHROME, + Request::USER_AGENT_FIREFOX, + Request::USER_AGENT_SAFARI, + ]); } /** diff --git a/lib/private/appframework/http/request.php b/lib/private/appframework/http/request.php index f4cbb6384ba..c8525d1d141 100644 --- a/lib/private/appframework/http/request.php +++ b/lib/private/appframework/http/request.php @@ -56,6 +56,14 @@ class Request implements \ArrayAccess, \Countable, IRequest { const USER_AGENT_IE = '/(MSIE)|(Trident)/'; const USER_AGENT_IE_8 = '/MSIE 8.0/'; + // Microsoft Edge User Agent from https://msdn.microsoft.com/en-us/library/hh869301(v=vs.85).aspx + const USER_AGENT_MS_EDGE = '/^Mozilla\/5\.0 \([^)]+\) AppleWebKit\/[0-9.]+ \(KHTML, like Gecko\) Chrome\/[0-9.]+ (Mobile Safari|Safari)\/[0-9.]+ Edge\/[0-9.]+$/'; + // Firefox User Agent from https://developer.mozilla.org/en-US/docs/Web/HTTP/Gecko_user_agent_string_reference + const USER_AGENT_FIREFOX = '/^Mozilla\/5\.0 \([^)]+\) Gecko\/[0-9.]+ Firefox\/[0-9.]+$/'; + // Chrome User Agent from https://developer.chrome.com/multidevice/user-agent + const USER_AGENT_CHROME = '/^Mozilla\/5\.0 \([^)]+\) AppleWebKit\/[0-9.]+ \(KHTML, like Gecko\) Chrome\/[0-9.]+ (Mobile Safari|Safari)\/[0-9.]+$/'; + // Safari User Agent from http://www.useragentstring.com/pages/Safari/ + const USER_AGENT_SAFARI = '/^Mozilla\/5\.0 \([^)]+\) AppleWebKit\/[0-9.]+ \(KHTML, like Gecko\) Version\/[0-9.]+ Safari\/[0-9.A-Z]+$/'; // 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$#'; |