mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-31 02:21:40 +01:00
Make sure replace only and only VT char (Vertical Tab)
This commit is contained in:
parent
4ada67ee81
commit
a987ddbe85
@ -6443,7 +6443,7 @@ class Mail
|
|||||||
*/
|
*/
|
||||||
static function clean_subject_for_filename($filename)
|
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));
|
return preg_replace($filter_pattern, "_", trim($filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,6 +65,7 @@ class SaveToVfsTest extends \EGroupware\Api\AppTest
|
|||||||
$this->assertNotContains('*', $cleaned);
|
$this->assertNotContains('*', $cleaned);
|
||||||
$this->assertNotContains('/', $cleaned);
|
$this->assertNotContains('/', $cleaned);
|
||||||
$this->assertNotContains('?', $cleaned);
|
$this->assertNotContains('?', $cleaned);
|
||||||
|
$this->assertNotContains('\x0b', $cleaned);
|
||||||
|
|
||||||
// Length should stay the same
|
// Length should stay the same
|
||||||
$this->assertEquals(strlen($filename), strlen($cleaned), 'Length changed');
|
$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 ?', 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)
|
array('This one contains them all < > " : | \ * / ? % are not allowed', true)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user