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;
|
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 = '(?<![?!.,:*_~])';
|
private const NO_TRAILING_PUNCT = '(?<![?!.,:*_~])';
|
||||||
|
|
||||||
/** @var string */
|
/** @var string */
|
||||||
@ -44,7 +44,7 @@ final class Url implements BacktrackingInline
|
|||||||
// this needs some work to follow spec
|
// this needs some work to follow spec
|
||||||
if (
|
if (
|
||||||
\preg_match(
|
\preg_match(
|
||||||
'/'.self::ABSOLUTE_URI.self::NO_TRAILING_PUNCT.'/iu',
|
'/'.self::URI.self::NO_TRAILING_PUNCT.'/iu',
|
||||||
$Excerpt->context(),
|
$Excerpt->context(),
|
||||||
$matches,
|
$matches,
|
||||||
\PREG_OFFSET_CAPTURE
|
\PREG_OFFSET_CAPTURE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user