mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-30 13:34:28 +02:00
Correctly show external picture attachments.
This commit is contained in:
parent
2e527525bc
commit
8b43faeeac
2 changed files with 6 additions and 2 deletions
|
@ -96,7 +96,7 @@ class PartAttachmentsColumn extends AbstractColumn
|
||||||
$tmp .= sprintf(
|
$tmp .= sprintf(
|
||||||
'<a href="%s" title="%s" class="attach-table-icon" target="_blank" rel="noopener" data-no-ajax>%s</a>',
|
'<a href="%s" title="%s" class="attach-table-icon" target="_blank" rel="noopener" data-no-ajax>%s</a>',
|
||||||
$this->urlGenerator->viewURL($attachment),
|
$this->urlGenerator->viewURL($attachment),
|
||||||
htmlspecialchars($attachment->getName()).': '.htmlspecialchars($attachment->getFilename()),
|
htmlspecialchars($attachment->getName()).': '.htmlspecialchars($attachment->getFilename() ?? $attachment->getHost() ?? ''),
|
||||||
$this->FAIconGenerator->generateIconHTML(
|
$this->FAIconGenerator->generateIconHTML(
|
||||||
// Sometimes the extension can not be determined, so ensure a generic icon is shown
|
// Sometimes the extension can not be determined, so ensure a generic icon is shown
|
||||||
$this->FAIconGenerator->fileExtensionToFAType($attachment->getExtension() ?? 'file'),
|
$this->FAIconGenerator->fileExtensionToFAType($attachment->getExtension() ?? 'file'),
|
||||||
|
|
|
@ -125,13 +125,17 @@ class AttachmentManager
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($attachment->isExternal()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
$absolute_path = $this->toAbsoluteFilePath($attachment);
|
$absolute_path = $this->toAbsoluteFilePath($attachment);
|
||||||
|
|
||||||
if (null === $absolute_path) {
|
if (null === $absolute_path) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return file_exists($absolute_path) || $attachment->isExternal();
|
return file_exists($absolute_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue