From f6a5e8cc4a3c55a8cd7aca5416ccdd9e5881e012 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 0087ac35d79f2..5c7edd51c8fcc 100644 --- a/lib/private/TaskProcessing/Manager.php +++ b/lib/private/TaskProcessing/Manager.php @@ -1569,9 +1569,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 760fe3788de4ecf473497dbaa5568254ab96f2da 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 5c7edd51c8fcc..34d39c265d176 100644 --- a/lib/private/TaskProcessing/Manager.php +++ b/lib/private/TaskProcessing/Manager.php @@ -1569,10 +1569,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 a3072cdf15d649d9536c361ad9b9bb4d5d2f8cd0 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 34d39c265d176..35ed7170c35cc 100644 --- a/lib/private/TaskProcessing/Manager.php +++ b/lib/private/TaskProcessing/Manager.php @@ -1574,7 +1574,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) {