From ed514a01bb8cd5381997b621debf23f32afa07f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Wed, 15 Mar 2023 22:15:30 +0100 Subject: [PATCH] Fixed exception when attachment file is not openable --- src/Services/EntityURLGenerator.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Services/EntityURLGenerator.php b/src/Services/EntityURLGenerator.php index 1ed659e4..591abcc2 100644 --- a/src/Services/EntityURLGenerator.php +++ b/src/Services/EntityURLGenerator.php @@ -164,23 +164,23 @@ class EntityURLGenerator throw new EntityNotSupportedException('The given entity is not supported yet!'); } - public function viewURL(Attachment $entity): ?string + public function viewURL(Attachment $entity): string { if ($entity->isExternal()) { //For external attachments, return the link to external path return $entity->getURL(); } //return $this->urlGenerator->generate('attachment_view', ['id' => $entity->getID()]); - return $this->attachmentURLGenerator->getViewURL($entity); + return $this->attachmentURLGenerator->getViewURL($entity) ?? ''; } - public function downloadURL($entity): ?string + public function downloadURL($entity): string { if ($entity instanceof Attachment) { if ($entity->isExternal()) { //For external attachments, return the link to external path return $entity->getURL(); } - return $this->attachmentURLGenerator->getDownloadURL($entity); + return $this->attachmentURLGenerator->getDownloadURL($entity) ?? ''; } //Otherwise throw an error