From 00bb55db11b4ef1671529d0ebb194e7bdc0b0f80 Mon Sep 17 00:00:00 2001 From: Vitor Mattos Date: Tue, 14 Jan 2025 10:39:27 -0300 Subject: [PATCH] fix: show that file not found when validate file Signed-off-by: Vitor Mattos --- lib/Service/FileService.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Service/FileService.php b/lib/Service/FileService.php index 478b9a8c80..09508d82b0 100644 --- a/lib/Service/FileService.php +++ b/lib/Service/FileService.php @@ -264,7 +264,7 @@ private function getFile(): \OCP\Files\File { } $fileToValidate = $this->root->getById($nodeId); if (!count($fileToValidate)) { - throw new LibresignException($this->l10n->t('Invalid data to validate file'), 404); + throw new LibresignException($this->l10n->t('File not found'), 404); } /** @var \OCP\Files\File */ return current($fileToValidate); @@ -276,6 +276,8 @@ private function getFileContent(): string { } elseif ($this->file) { try { return $this->fileContent = $this->getFile()->getContent(); + } catch (LibresignException $e) { + throw new LibresignException($e->getMessage(), 404); } catch (\Throwable $th) { throw new LibresignException($this->l10n->t('Invalid data to validate file'), 404); }