From: Hypolite Petovan Date: Sun, 26 Jan 2025 17:38:15 +0000 (-0500) Subject: Avoid matching invalid URLs in Model\Post\Media::insertFromRelevantUrl X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=b4b7e9a3c7e5301aa8adf7495ec240aa6733f5da;p=friendica.git Avoid matching invalid URLs in Model\Post\Media::insertFromRelevantUrl - Replace * with + to prevent matching empty domains --- 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);