Make sure replace only and only VT char (Vertical Tab)

This commit is contained in:
Hadi Nategh 2018-03-02 12:13:13 +01:00
parent 205cf9c588
commit 63dd5ce96b
2 changed files with 3 additions and 1 deletions

View File

@ -6443,7 +6443,7 @@ class Mail
*/
static function clean_subject_for_filename($filename)
{
static $filter_pattern = '$[\f\n\t\v\\:*#?<>%"\|/\\\?]$';
static $filter_pattern = '$[\f\n\t\x0b\:*#?<>%"\|/\\\?]$';
return preg_replace($filter_pattern, "_", trim($filename));
}

View File

@ -65,6 +65,7 @@ class SaveToVfsTest extends \EGroupware\Api\AppTest
$this->assertNotContains('*', $cleaned);
$this->assertNotContains('/', $cleaned);
$this->assertNotContains('?', $cleaned);
$this->assertNotContains('\x0b', $cleaned);
// Length should stay the same
$this->assertEquals(strlen($filename), strlen($cleaned), 'Length changed');
@ -94,6 +95,7 @@ class SaveToVfsTest extends \EGroupware\Api\AppTest
array('Contains a /', true),
array('Contains a ?', true),
array('Contains a %', true),
array('Contains a '.chr(11), true),
array('This one contains them all < > " : | \ * / ? % are not allowed', true)
);
}