1
0
mirror of https://github.com/erusev/parsedown.git synced 2023-08-10 21:13:06 +03:00

Restrict autolinks to https

This commit is contained in:
Aidan Woods 2021-10-12 18:21:17 +01:00
parent 2ea4bece92
commit a48c451d6c
No known key found for this signature in database
GPG Key ID: 9A6A8EFAA512BBB9

View File

@ -14,7 +14,7 @@ final class Url implements BacktrackingInline
{
use WidthTrait;
private const ABSOLUTE_URI = '[a-z][a-z0-9+.-]{1,31}:[^\s[:cntrl:]<>]*';
private const URI = 'https?+:[^\s[:cntrl:]<>]*';
private const NO_TRAILING_PUNCT = '(?<![?!.,:*_~])';
/** @var string */
@ -44,7 +44,7 @@ final class Url implements BacktrackingInline
// this needs some work to follow spec
if (
\preg_match(
'/'.self::ABSOLUTE_URI.self::NO_TRAILING_PUNCT.'/iu',
'/'.self::URI.self::NO_TRAILING_PUNCT.'/iu',
$Excerpt->context(),
$matches,
\PREG_OFFSET_CAPTURE