aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Klehr <mklehr@gmx.net>2024-07-26 13:22:41 +0200
committerAndy Scherzinger <info@andy-scherzinger.de>2025-01-24 23:53:48 +0100
commit5f55acb2eb0871e4e88ff1c01f61a3178458aeeb (patch)
tree2ef55b05c0f59afb2b9d4f619a3d2dc0d26dae43
parent99c1838f8721248747bd2760ad9248bd83c7b376 (diff)
downloadnextcloud-server-backport/46780/stable30.tar.gz
nextcloud-server-backport/46780/stable30.zip
fix(TaskProcessing): Catch JSON encode errors in Manager#setTaskResultbackport/46780/stable30
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
-rw-r--r--lib/private/TaskProcessing/Manager.php8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/private/TaskProcessing/Manager.php b/lib/private/TaskProcessing/Manager.php
index e0128dbaad2..b546c1e75ad 100644
--- a/lib/private/TaskProcessing/Manager.php
+++ b/lib/private/TaskProcessing/Manager.php
@@ -935,7 +935,7 @@ class Manager implements IManager {
$task->setEndedAt(time());
$error = 'The task was processed successfully but the provider\'s output doesn\'t pass validation against the task type\'s outputShape spec and/or the provider\'s own optionalOutputShape spec';
$task->setErrorMessage($error);
- $this->logger->error($error, ['exception' => $e]);
+ $this->logger->error($error . ' Output was: ' . var_export($result, true), ['exception' => $e]);
} catch (NotPermittedException $e) {
$task->setProgress(1);
$task->setStatus(Task::STATUS_FAILED);
@@ -952,7 +952,11 @@ class Manager implements IManager {
$this->logger->error($error, ['exception' => $e]);
}
}
- $taskEntity = \OC\TaskProcessing\Db\Task::fromPublicTask($task);
+ try {
+ $taskEntity = \OC\TaskProcessing\Db\Task::fromPublicTask($task);
+ } catch (\JsonException $e) {
+ throw new \OCP\TaskProcessing\Exception\Exception('The task was processed successfully but the provider\'s output could not be encoded as JSON for the database.', 0, $e);
+ }
try {
$this->taskMapper->update($taskEntity);
$this->runWebhook($task);