Correctly show external picture attachments.

This commit is contained in:
Jan Böhmer 2020-05-22 22:24:36 +02:00
parent 2e527525bc
commit 8b43faeeac
2 changed files with 6 additions and 2 deletions

View file

@ -96,7 +96,7 @@ class PartAttachmentsColumn extends AbstractColumn
$tmp .= sprintf(
'<a href="%s" title="%s" class="attach-table-icon" target="_blank" rel="noopener" data-no-ajax>%s</a>',
$this->urlGenerator->viewURL($attachment),
htmlspecialchars($attachment->getName()).': '.htmlspecialchars($attachment->getFilename()),
htmlspecialchars($attachment->getName()).': '.htmlspecialchars($attachment->getFilename() ?? $attachment->getHost() ?? ''),
$this->FAIconGenerator->generateIconHTML(
// Sometimes the extension can not be determined, so ensure a generic icon is shown
$this->FAIconGenerator->fileExtensionToFAType($attachment->getExtension() ?? 'file'),

View file

@ -125,13 +125,17 @@ class AttachmentManager
return false;
}
if ($attachment->isExternal()) {
return true;
}
$absolute_path = $this->toAbsoluteFilePath($attachment);
if (null === $absolute_path) {
return false;
}
return file_exists($absolute_path) || $attachment->isExternal();
return file_exists($absolute_path);
}
/**