Reduce probing / handle exception for invalid url / always check for https

This commit is contained in:
Michael 2024-06-13 06:16:52 +00:00
parent ae7001ebde
commit ab06d1964c
3 changed files with 30 additions and 18 deletions

View file

@ -2124,7 +2124,12 @@ class BBCode
}
$parts['host'] = idn_to_ascii(urldecode($parts['host']));
return (string)Uri::fromParts($parts);
try {
return (string)Uri::fromParts($parts);
} catch (\Throwable $th) {
Logger::notice('Exception on unparsing url', ['url' => $url, 'parts' => $parts, 'code' => $th->getCode(), 'message' => $th->getMessage()]);
return $url;
}
}
private static function unifyLinks(string $text): string