Avoid matching invalid URLs in Model\Post\Media::insertFromRelevantUrl

- Replace * with + to prevent matching empty domains
This commit is contained in:
Hypolite Petovan 2025-01-26 12:38:15 -05:00
parent 657c04a041
commit b4b7e9a3c7

View file

@ -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);