Closed \XF\Entity\Thread::getCoverImage does not consider all thumbnails as candidates

Kirby

Well-known member
Licensed customer
Affected version
2.2.13
PHP:
$attachments = $attachments->filter(function(Attachment $attachment) use ($canViewAttachments)
{
    if ($attachment->type_grouping != 'image')
    {
        return false;
    }

    return $canViewAttachments || $attachment->hasThumbnail();
});

This code ignores attachments that have thumbnails but are not grouped as images.

Changing this to
PHP:
$attachments = $attachments->filter(function(Attachment $attachment) use ($canViewAttachments)
{
    return $canViewAttachments || $attachment->hasThumbnail();
});

and also (2x)
PHP:
$coverImageUrl = $canViewAttachments

to

PHP:
$coverImageUrl = ($canViewAttachments && $attachment->type_grouping === 'image')

seems to fix this.
 
Automated triage: Not a bug

Thank you for reporting this issue. The cover image code this report refers to has since been rewritten. Current versions no longer use attachment thumbnails as cover images, so this no longer applies. If you still see a cover image problem on the current version, please open a new report with steps to reproduce it.

This is an automated assessment. A member of staff may review and update it.
 
Back
Top Bottom