fix IE8 user agent detection
This commit is contained in:
parent
c7aef6c368
commit
bf579a153f
|
@ -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';
|
||||
}
|
||||
|
|
|
@ -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$#';
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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';
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue