summaryrefslogtreecommitdiffstats
path: root/settings/controller/certificatecontroller.php
diff options
context:
space:
mode:
Diffstat (limited to 'settings/controller/certificatecontroller.php')
-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);
}
}