diff --git a/apps/files/lib/Controller/DirectEditingController.php b/apps/files/lib/Controller/DirectEditingController.php index e5bf00335abc4..a2e765072f2d4 100644 --- a/apps/files/lib/Controller/DirectEditingController.php +++ b/apps/files/lib/Controller/DirectEditingController.php @@ -77,7 +77,7 @@ public function info(): DataResponse { */ public function create(string $path, string $editorId, string $creatorId, string $templateId = null): DataResponse { if (!$this->directEditingManager->isEnabled()) { - return new DataResponse('Direct editing is not enabled', Http::STATUS_INTERNAL_SERVER_ERROR); + return new DataResponse(['message' => 'Direct editing is not enabled'], Http::STATUS_INTERNAL_SERVER_ERROR); } $this->eventDispatcher->dispatchTyped(new RegisterDirectEditorEvent($this->directEditingManager)); @@ -88,7 +88,7 @@ public function create(string $path, string $editorId, string $creatorId, string ]); } catch (Exception $e) { $this->logger->logException($e, ['message' => 'Exception when creating a new file through direct editing']); - return new DataResponse('Failed to create file: ' . $e->getMessage(), Http::STATUS_FORBIDDEN); + return new DataResponse(['message' => 'Failed to create file: ' . $e->getMessage()], Http::STATUS_FORBIDDEN); } } @@ -97,7 +97,7 @@ public function create(string $path, string $editorId, string $creatorId, string */ public function open(string $path, string $editorId = null): DataResponse { if (!$this->directEditingManager->isEnabled()) { - return new DataResponse('Direct editing is not enabled', Http::STATUS_INTERNAL_SERVER_ERROR); + return new DataResponse(['message' => 'Direct editing is not enabled'], Http::STATUS_INTERNAL_SERVER_ERROR); } $this->eventDispatcher->dispatchTyped(new RegisterDirectEditorEvent($this->directEditingManager)); @@ -108,7 +108,7 @@ public function open(string $path, string $editorId = null): DataResponse { ]); } catch (Exception $e) { $this->logger->logException($e, ['message' => 'Exception when opening a file through direct editing']); - return new DataResponse('Failed to open file: ' . $e->getMessage(), Http::STATUS_FORBIDDEN); + return new DataResponse(['message' => 'Failed to open file: ' . $e->getMessage()], Http::STATUS_FORBIDDEN); } } @@ -119,7 +119,7 @@ public function open(string $path, string $editorId = null): DataResponse { */ public function templates(string $editorId, string $creatorId): DataResponse { if (!$this->directEditingManager->isEnabled()) { - return new DataResponse('Direct editing is not enabled', Http::STATUS_INTERNAL_SERVER_ERROR); + return new DataResponse(['message' => 'Direct editing is not enabled'], Http::STATUS_INTERNAL_SERVER_ERROR); } $this->eventDispatcher->dispatchTyped(new RegisterDirectEditorEvent($this->directEditingManager)); @@ -127,7 +127,7 @@ public function templates(string $editorId, string $creatorId): DataResponse { return new DataResponse($this->directEditingManager->getTemplates($editorId, $creatorId)); } catch (Exception $e) { $this->logger->logException($e); - return new DataResponse('Failed to obtain template list: ' . $e->getMessage(), Http::STATUS_INTERNAL_SERVER_ERROR); + return new DataResponse(['message' => 'Failed to obtain template list: ' . $e->getMessage()], Http::STATUS_INTERNAL_SERVER_ERROR); } } }