mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-20 17:15:51 +02:00
Fixed error 500 if internal attachment path was not resolvable to an URL
This fixes issue #898
This commit is contained in:
parent
d3b225771c
commit
1daf6f01f4
1 changed files with 4 additions and 2 deletions
|
@ -156,8 +156,10 @@ class EntityURLGenerator
|
||||||
|
|
||||||
public function viewURL(Attachment $entity): string
|
public function viewURL(Attachment $entity): string
|
||||||
{
|
{
|
||||||
if ($entity->hasInternal()) {
|
//If the underlying file path is invalid, null gets returned, which is not allowed here.
|
||||||
return $this->attachmentURLGenerator->getInternalViewURL($entity);
|
//We still have the chance to use an external path, if it is set.
|
||||||
|
if ($entity->hasInternal() && ($url = $this->attachmentURLGenerator->getInternalViewURL($entity)) !== null) {
|
||||||
|
return $url;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($entity->hasExternal()) {
|
if($entity->hasExternal()) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue