diff options
author | Vincent Petry <pvince81@owncloud.com> | 2015-08-26 17:08:25 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2015-10-09 11:19:05 +0200 |
commit | c7aef6c36833b1d9bdec9dc30ceb874b8cb93019 (patch) | |
tree | e037f244957f18d0182c71532e6d2f7db5158a8f /lib | |
parent | 5cb83937faf7a6cf72c932346fcf62073d4b405b (diff) | |
download | nextcloud-server-c7aef6c36833b1d9bdec9dc30ceb874b8cb93019.tar.gz nextcloud-server-c7aef6c36833b1d9bdec9dc30ceb874b8cb93019.zip |
Fix uploading avatar and root certs in IE8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/public/appframework/controller.php | 8 | ||||
-rw-r--r-- | lib/public/util.php | 14 |
2 files changed, 21 insertions, 1 deletions
diff --git a/lib/public/appframework/controller.php b/lib/public/appframework/controller.php index b8986c0b772..5c7292cd130 100644 --- a/lib/public/appframework/controller.php +++ b/lib/public/appframework/controller.php @@ -83,7 +83,13 @@ abstract class Controller { $data->getData(), $data->getStatus() ); - $response->setHeaders(array_merge($data->getHeaders(), $response->getHeaders())); + $dataHeaders = $data->getHeaders(); + $headers = $response->getHeaders(); + // do not overwrite Content-Type if it already exists + if (isset($dataHeaders['Content-Type'])) { + unset($headers['Content-Type']); + } + $response->setHeaders(array_merge($dataHeaders, $headers)); return $response; } else { return new JSONResponse($data); diff --git a/lib/public/util.php b/lib/public/util.php index 76b61347d46..2b81b6bfc49 100644 --- a/lib/public/util.php +++ b/lib/public/util.php @@ -670,4 +670,18 @@ 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; + } } |