Add support for file names with multiple dots (#4211)

Fixes #4210. Credit to @GinoPane
This commit is contained in:
Siarhei Karavai 2019-03-25 18:57:06 +03:00 committed by Luke Towers
parent 3363b219f6
commit 8606db9e77
2 changed files with 18 additions and 2 deletions

View File

@ -530,7 +530,7 @@ class VersionManager
protected function extractScriptsAndComments($details) protected function extractScriptsAndComments($details)
{ {
if (is_array($details)) { if (is_array($details)) {
$fileNamePattern = '/^[a-z_\-0-9]*\.php$/i'; $fileNamePattern = '/^[a-z_\-0-9\.]*\.php$/i';
$comments = array_values(array_filter($details, function ($detail) use ($fileNamePattern) { $comments = array_values(array_filter($details, function ($detail) use ($fileNamePattern) {
return !preg_match($fileNamePattern, $detail); return !preg_match($fileNamePattern, $detail);
@ -545,5 +545,5 @@ class VersionManager
} }
return array($comments, $scripts); return array($comments, $scripts);
} }
} }

View File

@ -170,6 +170,22 @@ class VersionManagerTest extends TestCase
'scripts_can_go_first.php', 'scripts_can_go_first.php',
'scripts_can_go_anywhere.php' 'scripts_can_go_anywhere.php'
] ]
],
[
[
'file.name.with.dots.php',
'The first update comment',
'1.0.2.scripts_can_go_anywhere.php',
'The second update comment',
],
[
'The first update comment',
'The second update comment'
],
[
'file.name.with.dots.php',
'1.0.2.scripts_can_go_anywhere.php'
]
] ]
]; ];
} }