From da912e237af566d8c397accef61a9f31c7fca015 Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Thu, 7 May 2026 14:50:44 +0200 Subject: [PATCH 1/3] fix(TaskProcessing): Normalize file ID before getting node Signed-off-by: Marcel Klehr --- lib/private/TaskProcessing/Manager.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/private/TaskProcessing/Manager.php b/lib/private/TaskProcessing/Manager.php index d317436d59b5e..e2bae7d8e8822 100644 --- a/lib/private/TaskProcessing/Manager.php +++ b/lib/private/TaskProcessing/Manager.php @@ -1735,9 +1735,16 @@ private function validateOutputFileIds(array $output, ...$specs): array { * @throws ValidationException */ private function validateFileId(mixed $id): File { - $node = $this->rootFolder->getFirstNodeById($id); + if (is_int($fileId)) { + $normalizedFileId = $fileId; + } elseif (is_string($fileId) && ctype_digit($fileId)) { + $normalizedFileId = (int)$fileId; + } else { + throw new \InvalidArgumentException('File ID must be an integer: ' . $id); + } + $node = $this->rootFolder->getFirstNodeById($normalizedFileId); if ($node === null) { - $node = $this->rootFolder->getFirstNodeByIdInPath($id, '/' . $this->rootFolder->getAppDataDirectoryName() . '/'); + $node = $this->rootFolder->getFirstNodeByIdInPath($normalizedFileId, '/' . $this->rootFolder->getAppDataDirectoryName() . '/'); if ($node === null) { throw new ValidationException('Could not find file ' . $id); } elseif (!$node instanceof File) { From c7d6b25d0f5c4e2de1b045311b7167744837fbd5 Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Mon, 11 May 2026 13:47:11 +0200 Subject: [PATCH 2/3] Fix: Fix copy-pasta Signed-off-by: Marcel Klehr --- lib/private/TaskProcessing/Manager.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/private/TaskProcessing/Manager.php b/lib/private/TaskProcessing/Manager.php index e2bae7d8e8822..3ec61cd306ee3 100644 --- a/lib/private/TaskProcessing/Manager.php +++ b/lib/private/TaskProcessing/Manager.php @@ -1735,10 +1735,10 @@ private function validateOutputFileIds(array $output, ...$specs): array { * @throws ValidationException */ private function validateFileId(mixed $id): File { - if (is_int($fileId)) { - $normalizedFileId = $fileId; - } elseif (is_string($fileId) && ctype_digit($fileId)) { - $normalizedFileId = (int)$fileId; + if (is_int($id)) { + $normalizedFileId = $id; + } elseif (is_string($id) && ctype_digit($id)) { + $normalizedFileId = (int)$id; } else { throw new \InvalidArgumentException('File ID must be an integer: ' . $id); } From 73cb8c9bbe7bf63fab5e1bdc62e0928948208c20 Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Mon, 9 Nov 2026 12:07:43 +0100 Subject: [PATCH 3/3] fix: Apply suggestion from @kyteinsky Signed-off-by: Marcel Klehr --- lib/private/TaskProcessing/Manager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/private/TaskProcessing/Manager.php b/lib/private/TaskProcessing/Manager.php index 3ec61cd306ee3..a02e28ca762de 100644 --- a/lib/private/TaskProcessing/Manager.php +++ b/lib/private/TaskProcessing/Manager.php @@ -1740,7 +1740,7 @@ private function validateFileId(mixed $id): File { } elseif (is_string($id) && ctype_digit($id)) { $normalizedFileId = (int)$id; } else { - throw new \InvalidArgumentException('File ID must be an integer: ' . $id); + throw new ValidationException('File ID must be an integer: ' . $id); } $node = $this->rootFolder->getFirstNodeById($normalizedFileId); if ($node === null) {