Fixed exception on edit page for parts.

This commit is contained in:
Jan Böhmer 2019-10-13 13:27:04 +02:00
parent 329d8c871e
commit d2a8055384

View file

@ -125,11 +125,14 @@ class AttachmentURLGenerator
throw new \InvalidArgumentException('Thumbnail creation only works for picture attachments!'); throw new \InvalidArgumentException('Thumbnail creation only works for picture attachments!');
} }
if ($attachment->isExternal()) {
return $attachment->getURL();
}
$absolute_path = $this->attachmentHelper->toAbsoluteFilePath($attachment); $absolute_path = $this->attachmentHelper->toAbsoluteFilePath($attachment);
if ($absolute_path === null) { if ($absolute_path === null) {
throw new \RuntimeException( throw new \RuntimeException(
'The given attachment is external or has no valid file, so no URL can get generated for it! 'The given attachment is external or has no valid file, so no URL can get generated for it!'
Use Attachment::getURL() to get the external URL!'
); );
} }