diff options
author | provokateurin <kate@provokateurin.de> | 2025-05-14 15:51:42 +0200 |
---|---|---|
committer | provokateurin <kate@provokateurin.de> | 2025-05-15 00:16:54 +0200 |
commit | 82fb8f850828d24f551ad5ef3b8523486e5104df (patch) | |
tree | 4b7bf5bcd5e8f37b1a70a9dec1f80729b97ef6e6 /core/Controller/TaskProcessingApiController.php | |
parent | c3ddd1da46c9f75071f61d3cf7381570297a74d6 (diff) | |
download | nextcloud-server-refactor/rector-core.tar.gz nextcloud-server-refactor/rector-core.zip |
refactor: Extend rector to core/refactor/rector-core
Signed-off-by: provokateurin <kate@provokateurin.de>
Diffstat (limited to 'core/Controller/TaskProcessingApiController.php')
-rw-r--r-- | core/Controller/TaskProcessingApiController.php | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/core/Controller/TaskProcessingApiController.php b/core/Controller/TaskProcessingApiController.php index 2f5a81ea7a8..cf62b4f6b6b 100644 --- a/core/Controller/TaskProcessingApiController.php +++ b/core/Controller/TaskProcessingApiController.php @@ -17,10 +17,12 @@ use OCP\AppFramework\Http\Attribute\AnonRateLimit; use OCP\AppFramework\Http\Attribute\ApiRoute; use OCP\AppFramework\Http\Attribute\ExAppRequired; use OCP\AppFramework\Http\Attribute\NoAdminRequired; +use OCP\AppFramework\Http\Attribute\NoCSRFRequired; use OCP\AppFramework\Http\Attribute\PublicPage; use OCP\AppFramework\Http\Attribute\UserRateLimit; use OCP\AppFramework\Http\DataDownloadResponse; use OCP\AppFramework\Http\DataResponse; +use OCP\AppFramework\OCSController; use OCP\Files\File; use OCP\Files\GenericFileException; use OCP\Files\IAppData; @@ -45,7 +47,7 @@ use stdClass; * @psalm-import-type CoreTaskProcessingTask from ResponseDefinitions * @psalm-import-type CoreTaskProcessingTaskType from ResponseDefinitions */ -class TaskProcessingApiController extends \OCP\AppFramework\OCSController { +class TaskProcessingApiController extends OCSController { public function __construct( string $appName, IRequest $request, @@ -306,9 +308,9 @@ class TaskProcessingApiController extends \OCP\AppFramework\OCSController { * 404: Task or file not found */ #[NoAdminRequired] - #[Http\Attribute\NoCSRFRequired] + #[NoCSRFRequired] #[ApiRoute(verb: 'GET', url: '/tasks/{taskId}/file/{fileId}', root: '/taskprocessing')] - public function getFileContents(int $taskId, int $fileId): Http\DataDownloadResponse|DataResponse { + public function getFileContents(int $taskId, int $fileId): DataDownloadResponse|DataResponse { try { $task = $this->taskProcessingManager->getUserTask($taskId, $this->userId); return $this->getFileContentsInternal($task, $fileId); @@ -331,7 +333,7 @@ class TaskProcessingApiController extends \OCP\AppFramework\OCSController { */ #[ExAppRequired] #[ApiRoute(verb: 'GET', url: '/tasks_provider/{taskId}/file/{fileId}', root: '/taskprocessing')] - public function getFileContentsExApp(int $taskId, int $fileId): Http\DataDownloadResponse|DataResponse { + public function getFileContentsExApp(int $taskId, int $fileId): DataDownloadResponse|DataResponse { try { $task = $this->taskProcessingManager->getTask($taskId); return $this->getFileContentsInternal($task, $fileId); @@ -384,7 +386,7 @@ class TaskProcessingApiController extends \OCP\AppFramework\OCSController { * * @return DataDownloadResponse<Http::STATUS_OK, string, array{}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR|Http::STATUS_NOT_FOUND, array{message: string}, array{}> */ - private function getFileContentsInternal(Task $task, int $fileId): Http\DataDownloadResponse|DataResponse { + private function getFileContentsInternal(Task $task, int $fileId): DataDownloadResponse|DataResponse { $ids = $this->extractFileIdsFromTask($task); if (!in_array($fileId, $ids)) { return new DataResponse(['message' => $this->l->t('Not found')], Http::STATUS_NOT_FOUND); @@ -401,7 +403,7 @@ class TaskProcessingApiController extends \OCP\AppFramework\OCSController { } elseif (!$node instanceof File) { throw new NotFoundException('Node is not a file'); } - return new Http\DataDownloadResponse($node->getContent(), $node->getName(), $node->getMimeType()); + return new DataDownloadResponse($node->getContent(), $node->getName(), $node->getMimeType()); } /** |