diff --git a/lib/Service/FolderService.php b/lib/Service/FolderService.php index 1255ccd0b4..e0eda154c1 100644 --- a/lib/Service/FolderService.php +++ b/lib/Service/FolderService.php @@ -82,6 +82,13 @@ public function getFolder(): Folder { * @throws NotFoundException */ public function getFileById(int $nodeId = null): File { + if ($this->getUserId()) { + $folder = $this->root->getUserFolder($this->getUserId()); + $file = $folder->getById($nodeId); + if ($file) { + return current($file); + } + } $path = $this->getLibreSignDefaultPath(); $containerFolder = $this->getContainerFolder(); if (!$containerFolder->nodeExists($path)) { diff --git a/lib/Service/PdfParserService.php b/lib/Service/PdfParserService.php index b6af95da89..497b8b27aa 100644 --- a/lib/Service/PdfParserService.php +++ b/lib/Service/PdfParserService.php @@ -42,7 +42,10 @@ public function __construct( * @psalm-return array{p: int, d?: non-empty-list} */ public function getMetadata(File $node): array { - $content = $node->getContent(); + try { + $content = $node->getContent(); + } catch (\Throwable $th) { + } if (!$content) { throw new LibresignException('Empty file.'); }