mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-23 18:28:49 +02:00
Support external hosted attachments via link.
This commit is contained in:
parent
87db2523e1
commit
ca48343293
3 changed files with 46 additions and 2 deletions
|
@ -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()]);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue