diff --git a/core/Controller/TaskProcessingApiController.php b/core/Controller/TaskProcessingApiController.php index da1f339beac61..26fc93a4cd3c0 100644 --- a/core/Controller/TaskProcessingApiController.php +++ b/core/Controller/TaskProcessingApiController.php @@ -351,6 +351,9 @@ private function getFileContentsInternal(Task $task, int $fileId): Http\DataDown if (!in_array($fileId, $ids)) { return new DataResponse(['message' => $this->l->t('Not found')], Http::STATUS_NOT_FOUND); } + if ($task->getUserId() !== null) { + \OC_Util::setupFS($task->getUserId()); + } $node = $this->rootFolder->getFirstNodeById($fileId); if ($node === null) { $node = $this->rootFolder->getFirstNodeByIdInPath($fileId, '/' . $this->rootFolder->getAppDataDirectoryName() . '/');