Support external hosted attachments via link.

This commit is contained in:
Jan Böhmer 2019-08-10 19:16:56 +02:00
parent 87db2523e1
commit ca48343293
3 changed files with 46 additions and 2 deletions

View file

@ -95,6 +95,9 @@ class EntityURLGenerator
public function viewURL($entity) : string
{
if ($entity instanceof Attachment) {
if ($entity->isExternal()) { //For external attachments, return the link to external path
return $entity->getURL();
}
return $this->urlGenerator->generate('attachment_view', ['id' => $entity->getID()]);
}
@ -105,6 +108,9 @@ class EntityURLGenerator
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->urlGenerator->generate('attachment_download', ['id' => $entity->getID()]);
}