fix issue with periods in directory names
This commit is contained in:
parent
91436b4b51
commit
23742b8fe2
|
@ -58,6 +58,11 @@ class ComicPressMediaHandling {
|
|||
return $result;
|
||||
}
|
||||
|
||||
function _resolve_regex_path($input) {
|
||||
$input = str_replace('\.', '.', $input);
|
||||
return $input;
|
||||
}
|
||||
|
||||
// @codeCoverageIgnoreStart
|
||||
function _abspath() {
|
||||
return realpath(ABSPATH);
|
||||
|
@ -85,7 +90,7 @@ class ComicPressMediaHandling {
|
|||
}
|
||||
|
||||
function _read_directory($pattern) {
|
||||
$dirname = dirname($pattern);
|
||||
$dirname = $this->_resolve_regex_path(dirname($pattern));
|
||||
$results = false;
|
||||
if (is_dir($dirname)) {
|
||||
$results = array();
|
||||
|
|
|
@ -141,6 +141,20 @@ class ComicPressMediaHandlingTest extends PHPUnit_Framework_TestCase {
|
|||
$this->assertEquals($expected_results, $this->cpmh->_read_directory($pattern));
|
||||
}
|
||||
|
||||
function providerTestResolveRegexPath() {
|
||||
return array(
|
||||
array('test', 'test'),
|
||||
array('te\.st', 'te.st')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerTestResolveRegexPath
|
||||
*/
|
||||
function testResolveRegexPath($input, $expected_output) {
|
||||
$this->assertEquals($expected_output, $this->cpmh->_resolve_regex_path($input));
|
||||
}
|
||||
|
||||
function providerTestPreHandleComicPathResults() {
|
||||
return array(
|
||||
array('', '', false),
|
||||
|
|
Loading…
Reference in New Issue