Issue 10506 - again. Improved check for pictured in body

This commit is contained in:
Michael 2021-07-17 07:55:19 +00:00
parent 6331e1e71c
commit dd2abf254d
2 changed files with 2 additions and 2 deletions

View file

@ -2883,7 +2883,7 @@ class Item
// @todo In the future we should make a single for the template engine with all media in it. This allows more flexibilty. // @todo In the future we should make a single for the template engine with all media in it. This allows more flexibilty.
foreach ($attachments['visual'] as $attachment) { foreach ($attachments['visual'] as $attachment) {
if (self::containsLink($item['body'], $attachment['url'], $attachment['type'])) { if (self::containsLink($item['body'], $attachment['preview'] ?? $attachment['url'], $attachment['type'])) {
continue; continue;
} }

View file

@ -637,7 +637,7 @@ class Media
$body = preg_replace("/\s*\[attachment .*?\].*?\[\/attachment\]\s*/ism", '', $body); $body = preg_replace("/\s*\[attachment .*?\].*?\[\/attachment\]\s*/ism", '', $body);
foreach (self::getByURIId($uriid, [self::IMAGE, self::AUDIO, self::VIDEO]) as $media) { foreach (self::getByURIId($uriid, [self::IMAGE, self::AUDIO, self::VIDEO]) as $media) {
if (Item::containsLink($body, $media['url'], $media['type'])) { if (Item::containsLink($body, $media['preview'] ?? $media['url'], $media['type'])) {
continue; continue;
} }