Fixed an issue where collaboration systems with file attachments throw an error if attachment is not an image or the attachment is an image but doesn't have an associated icon. Also removed redundant calls to $storage->isImage and $storage->getUrl
This commit is contained in:
parent
b5e20607f8
commit
82e52fd8d5
1 changed files with 11 additions and 9 deletions
|
|
@ -730,23 +730,25 @@ sub getTemplateVars {
|
|||
unless ($self->get("storageId") eq "") {
|
||||
my $storage = $self->getStorageLocation;
|
||||
foreach my $filename (@{$storage->getFiles}) {
|
||||
if (!$gotImage && $storage->isImage($filename)) {
|
||||
$var{"image.url"} = $storage->getUrl($filename);
|
||||
my $isImage = $storage->isImage($filename);
|
||||
my $fileUrl = $storage->getUrl($filename);
|
||||
if (!$gotImage && $isImage) {
|
||||
$var{"image.url"} = $fileUrl;
|
||||
$var{"image.thumbnail"} = $storage->getThumbnailUrl($filename);
|
||||
$gotImage = 1;
|
||||
}
|
||||
if (!$gotAttachment && !$storage->isImage($filename)) {
|
||||
$var{"attachment.url"} = $storage->getUrl($filename);
|
||||
if (!$gotAttachment && !$isImage) {
|
||||
$var{"attachment.url"} = $fileUrl;
|
||||
$var{"attachment.icon"} = $storage->getFileIconUrl($filename);
|
||||
$var{"attachment.name"} = $filename;
|
||||
$gotAttachment = 1;
|
||||
}
|
||||
push(@{$var{"attachment_loop"}}, {
|
||||
url=>$storage->getUrl($filename),
|
||||
icon=>$storage->getFileIconUrl($filename),
|
||||
filename=>$filename,
|
||||
thumbnail=>$storage->getThumbnailUrl($filename),
|
||||
isImage=>$storage->isImage($filename)
|
||||
url =>$fileUrl,
|
||||
icon =>$var{"attachment.icon"},
|
||||
filename =>$filename,
|
||||
thumbnail =>$var{"image.thumbnail"},
|
||||
isImage =>$isImage
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue