]> git.mxchange.org Git - friendica.git/commitdiff
Avoid matching invalid URLs in Model\Post\Media::insertFromRelevantUrl
authorHypolite Petovan <hypolite@mrpetovan.com>
Sun, 26 Jan 2025 17:38:15 +0000 (12:38 -0500)
committerHypolite Petovan <hypolite@mrpetovan.com>
Sun, 26 Jan 2025 22:54:17 +0000 (17:54 -0500)
- Replace * with + to prevent matching empty domains

src/Model/Post/Media.php

index ed36d219c3cd1d1011fa1f2a96606a3cbaacf6cc..9ef6eef9eab3433d4406b0d8cd085d73ea630244 100644 (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);