MDL-85618 filter_displayh5p: change regular expression delimeter.
Ensure we don't confuse the expression parser when supplied "Allowed source" contains coincidental control characters in the URL, e.g. '/' and '#'. Note that `preg_quote(...)` isn't appropriate here, because the given URL may indeed contain genuine control characters already.
This commit is contained in:
@@ -60,8 +60,8 @@ class text_filter extends \core_filters\text_filter {
|
||||
'tagend' => '</iframe>',
|
||||
];
|
||||
|
||||
$specialchars = ['?', '&'];
|
||||
$escapedspecialchars = ['\?', '&'];
|
||||
$specialchars = ['~', '?', '&'];
|
||||
$escapedspecialchars = ['\~', '\?', '&'];
|
||||
$h5pcontents = [];
|
||||
$h5plinks = [];
|
||||
|
||||
@@ -103,7 +103,7 @@ class text_filter extends \core_filters\text_filter {
|
||||
$params + ['ish5plink' => false]
|
||||
);
|
||||
|
||||
$h5pcontenturl->workregexp = '#' . $ultimatepattern . '#';
|
||||
$h5pcontenturl->workregexp = '~' . $ultimatepattern . '~';
|
||||
$h5pcontents[] = $h5pcontenturl;
|
||||
|
||||
// Regex to find h5p extensions in an <a> tag.
|
||||
|
||||
Reference in New Issue
Block a user