Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2015-08-26 18:08:25 +0300
committerMorris Jobke <hey@morrisjobke.de>2015-10-09 12:19:05 +0300
commitc7aef6c36833b1d9bdec9dc30ceb874b8cb93019 (patch)
treee037f244957f18d0182c71532e6d2f7db5158a8f /settings/controller
parent5cb83937faf7a6cf72c932346fcf62073d4b405b (diff)
Fix uploading avatar and root certs in IE8
Diffstat (limited to 'settings/controller')
-rw-r--r--settings/controller/certificatecontroller.php19
1 files changed, 14 insertions, 5 deletions
diff --git a/settings/controller/certificatecontroller.php b/settings/controller/certificatecontroller.php
index 8ff9f51a66c..b7bc81920c2 100644
--- a/settings/controller/certificatecontroller.php
+++ b/settings/controller/certificatecontroller.php
@@ -68,19 +68,25 @@ class CertificateController extends Controller {
* @return array
*/
public function addPersonalRootCertificate() {
+ $headers = [];
+ if (\OCP\Util::isIE8()) {
+ // due to upload iframe workaround, need to set content-type to text/plain
+ $headers['Content-Type'] = 'text/plain';
+ }
if ($this->isCertificateImportAllowed() === false) {
- return new DataResponse('Individual certificate management disabled', Http::STATUS_FORBIDDEN);
+ return new DataResponse(['message' => 'Individual certificate management disabled'], Http::STATUS_FORBIDDEN, $headers);
}
$file = $this->request->getUploadedFile('rootcert_import');
if(empty($file)) {
- return new DataResponse(['message' => 'No file uploaded'], Http::STATUS_UNPROCESSABLE_ENTITY);
+ return new DataResponse(['message' => 'No file uploaded'], Http::STATUS_UNPROCESSABLE_ENTITY, $headers);
}
try {
$certificate = $this->certificateManager->addCertificate(file_get_contents($file['tmp_name']), $file['name']);
- return new DataResponse([
+ return new DataResponse(
+ [
'name' => $certificate->getName(),
'commonName' => $certificate->getCommonName(),
'organization' => $certificate->getOrganization(),
@@ -90,9 +96,12 @@ class CertificateController extends Controller {
'validTillString' => $this->l10n->l('date', $certificate->getExpireDate()),
'issuer' => $certificate->getIssuerName(),
'issuerOrganization' => $certificate->getIssuerOrganization(),
- ]);
+ ],
+ Http::STATUS_OK,
+ $headers
+ );
} catch (\Exception $e) {
- return new DataResponse('An error occurred.', Http::STATUS_UNPROCESSABLE_ENTITY);
+ return new DataResponse('An error occurred.', Http::STATUS_UNPROCESSABLE_ENTITY, $headers);
}
}