From dd2abf254d1d0113eb8bb7221794a62bd76a5296 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 17 Jul 2021 07:55:19 +0000 Subject: [PATCH] Issue 10506 - again. Improved check for pictured in body --- src/Model/Item.php | 2 +- src/Model/Post/Media.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Model/Item.php b/src/Model/Item.php index 86b9270fe9..b258e86470 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -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. 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; } diff --git a/src/Model/Post/Media.php b/src/Model/Post/Media.php index c0f09b8b90..801f192e9d 100644 --- a/src/Model/Post/Media.php +++ b/src/Model/Post/Media.php @@ -637,7 +637,7 @@ class Media $body = preg_replace("/\s*\[attachment .*?\].*?\[\/attachment\]\s*/ism", '', $body); 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; }