Skip to content

Commit

Permalink
fix: Fix missing conflicts on pdf templating
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <[email protected]>
  • Loading branch information
juliushaertl committed Aug 26, 2024
1 parent 672b187 commit 08b4d25
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions lib/Service/TemplateFieldService.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,16 @@ public function extractFields(Node|int $file): array {
}

try {
if (!$file || !$file instanceof File) {
throw new NotFoundException();

Check failure on line 50 in lib/Service/TemplateFieldService.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis

UndefinedClass

lib/Service/TemplateFieldService.php:50:15: UndefinedClass: Class, interface or enum named OCA\Richdocuments\Service\NotFoundException does not exist (see https://psalm.dev/019)
}

$localCache = $this->cacheFactory->createLocal('richdocuments_templates/');
$cacheName = $file->getId() . "/" . $file->getEtag();
$cachedResponse = $localCache->get($cacheName);

if ($cachedResponse !== null) {
// return $cachedResponse;
return $cachedResponse;
}

if ($file->getMimeType() === 'application/pdf') {
Expand Down Expand Up @@ -125,6 +129,13 @@ public function fillFields(Node|int $file, array $fields = [], ?string $destinat
$file = $this->rootFolder->getFirstNodeById($file);
}

if (!$file || !$file instanceof File) {
$e = new NotFoundException();

Check failure on line 133 in lib/Service/TemplateFieldService.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis

UndefinedClass

lib/Service/TemplateFieldService.php:133:13: UndefinedClass: Class, interface or enum named OCA\Richdocuments\Service\NotFoundException does not exist (see https://psalm.dev/019)
$this->logger->error($e->getMessage());

throw $e;
}

if ($file->getMimeType() === 'application/pdf') {
$content = $this->pdfService->fillFields($file, $fields);
if ($destination !== null) {
Expand Down

0 comments on commit 08b4d25

Please sign in to comment.