From b4b7e9a3c7e5301aa8adf7495ec240aa6733f5da Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sun, 26 Jan 2025 12:38:15 -0500 Subject: [PATCH] Avoid matching invalid URLs in Model\Post\Media::insertFromRelevantUrl - Replace * with + to prevent matching empty domains --- src/Model/Post/Media.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Model/Post/Media.php b/src/Model/Post/Media.php index ed36d219c3..9ef6eef9ea 100644 --- a/src/Model/Post/Media.php +++ b/src/Model/Post/Media.php @@ -796,7 +796,7 @@ class Media } // Search for links with descriptions - if (preg_match_all("/\[url\=(https?:.*?)\].*?\[\/url\]/ism", $body, $matches)) { + if (preg_match_all("#\[url=(https?://.+?)].+?\[/url]#ism", $body, $matches)) { foreach ($matches[1] as $url) { DI::logger()->info('Got page url (link with description)', ['uri-id' => $uriid, 'url' => $url]); $result = self::insert(['uri-id' => $uriid, 'type' => self::UNKNOWN, 'url' => $url], false); -- 2.39.5