mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-03-06 07:25:32 +01:00
Support external hosted attachments via link.
This commit is contained in:
@@ -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()]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user