Skip to content

Commit d5332e0

Browse files
committed
[FIX] #PLMDV-8: block-names are now escaped before used in a regex pattern.
1 parent 9acc332 commit d5332e0

File tree

4 files changed

+23
-1
lines changed

4 files changed

+23
-1
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# MDViewer Changelog
2+
3+
## v2.1.3
4+
5+
- Fixed issue where block-names with special characters lead to a broken regex pattern.
6+
- Added CHANGELOG.md

captainhook.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"commit-msg": {
3+
"enabled": true,
4+
"actions": [
5+
{
6+
"action": "\\CaptainHook\\App\\Hook\\Message\\Action\\Regex",
7+
"options": {
8+
"regex": "#^\\[(FIX|FEATURE|RELEASE|PATCH)\\] .*#i",
9+
"error": "Error, the commit message is invalid. Please ensure that it begins with either [FIX], [FEATURE] [RELEASE] or [PATCH].\n",
10+
"success": "Success, the commit message is valid."
11+
}
12+
}
13+
]
14+
}
15+
}

classes/class.ilMDViewerPluginGUI.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ protected function filterRawContentString($raw_content, $blocks)
181181
foreach ($blocks as $block) {
182182
// strip whitespaces and only process block if it's not empty.
183183
$block = $this->stripWhitespaces($block);
184+
$block = preg_quote($block, '\\');
184185
if ('' !== $block) {
185186
$regex = str_replace('{BLOCK_NAME}', $block, $regex_template);
186187
preg_match($regex, $raw_content, $matches);

plugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
$id = 'md_tme';
3-
$version = '2.1.2';
3+
$version = '2.1.3';
44
$ilias_min_version = '6.000';
55
$ilias_max_version = '7.999';
66
$responsible = 'sr solutions ag';

0 commit comments

Comments
 (0)