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:
parent
2ea4bece92
commit
a48c451d6c
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user