Fixes validation of requested partial names VS. partial names on file system
This commit is contained in:
parent
7395dc520a
commit
7ecf361eb3
|
|
@ -308,7 +308,7 @@ class Controller extends Extendable
|
|||
|
||||
// @todo Do we need to validate backend partials?
|
||||
// foreach ($partialList as $partial) {
|
||||
// if (!CmsFileHelper::validateName($partial))
|
||||
// if (!preg_match('/^(?:\w+\:{2}|@)?[a-z0-9\_\-\.\/]+$/i', $partial))
|
||||
// throw new SystemException(Lang::get('cms::lang.partial.invalid_name', ['name'=>$partial]));
|
||||
// }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -332,7 +332,7 @@ class Controller extends BaseController
|
|||
$partialList = explode('&', $partialList);
|
||||
|
||||
foreach ($partialList as $partial) {
|
||||
if (!CmsFileHelper::validateName($partial))
|
||||
if (!preg_match('/^(?:\w+\:{2}|@)?[a-z0-9\_\-\.\/]+$/i', $partial))
|
||||
throw new CmsException(Lang::get('cms::lang.partial.invalid_name', ['name'=>$partial]));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ class FileHelper
|
|||
*/
|
||||
public static function validateName($fileName)
|
||||
{
|
||||
return preg_match('/^([a-z0-9\-\.]+\:{2})?[a-z0-9\_\-\.\/]+$/i', $fileName) ? true : false;
|
||||
return preg_match('/^[a-z0-9\_\-\.\/]+$/i', $fileName) ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@ class FileHelperTest extends TestCase
|
|||
$this->assertFalse(FileHelper::validateName('test\testdat'));
|
||||
$this->assertTrue(FileHelper::validateName('01test-test.dat'));
|
||||
$this->assertFalse(FileHelper::validateName('test@test.dat'));
|
||||
$this->assertFalse(FileHelper::validateName('test::test'));
|
||||
$this->assertFalse(FileHelper::validateName('@test'));
|
||||
}
|
||||
|
||||
public function testFormatIniString()
|
||||
|
|
|
|||
Loading…
Reference in New Issue