diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2016-04-04 13:51:23 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2016-04-04 13:51:23 +0200 |
commit | f6cea3c9c436142110504ba76320d57ca7899b27 (patch) | |
tree | e46789e7edb33f24c25871e23e067cb6f27383c9 /lib | |
parent | 53c19027069707576f43fa9fc4c79324188a98de (diff) | |
parent | 95820fbd5b7a5d8241061ad30d5bf6c4fc8613d7 (diff) | |
download | nextcloud-server-f6cea3c9c436142110504ba76320d57ca7899b27.tar.gz nextcloud-server-f6cea3c9c436142110504ba76320d57ca7899b27.zip |
Merge pull request #23557 from owncloud/sabre-plugin-browser-error-page
In case of exception we return an html page in case the client is a b…
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/appframework/http/request.php | 8 | ||||
-rw-r--r-- | lib/private/template.php | 5 |
2 files changed, 12 insertions, 1 deletions
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$#'; diff --git a/lib/private/template.php b/lib/private/template.php index bc706e29344..2653ae6086a 100644 --- a/lib/private/template.php +++ b/lib/private/template.php @@ -333,7 +333,7 @@ class OC_Template extends \OC\Template\Base { * print error page using Exception details * @param Exception $exception */ - public static function printExceptionErrorPage($exception) { + public static function printExceptionErrorPage($exception, $fetchPage = false) { try { $request = \OC::$server->getRequest(); $content = new \OC_Template('', 'exception', 'error', false); @@ -346,6 +346,9 @@ class OC_Template extends \OC\Template\Base { $content->assign('debugMode', \OC::$server->getSystemConfig()->getValue('debug', false)); $content->assign('remoteAddr', $request->getRemoteAddress()); $content->assign('requestID', $request->getId()); + if ($fetchPage) { + return $content->fetchPage(); + } $content->printPage(); } catch (\Exception $e) { $logger = \OC::$server->getLogger(); |