fixing function and test

This commit is contained in:
Ralf Becker 2018-04-11 14:05:49 +02:00
parent 8950a0fd99
commit ad95a01cec
2 changed files with 3 additions and 7 deletions

View File

@ -6447,7 +6447,7 @@ class Mail
*/ */
static function clean_subject_for_filename($filename) static function clean_subject_for_filename($filename)
{ {
static $filter_pattern = '$[\f\n\t\x0b\:*#?<>%"\|/\x{10000}-\x{10FFFF}]$u'; static $filter_pattern = '$[\f\n\t\x0b\:*#?<>%"\|/\x{10000}-\x{10FFFF}\\\\]$u';
$file = trim(preg_replace($filter_pattern, ' ', $filename)); $file = trim(preg_replace($filter_pattern, ' ', $filename));
if (empty($file)) $file = lang('empty'); if (empty($file)) $file = lang('empty');
return $file; return $file;

View File

@ -13,11 +13,7 @@
namespace EGroupware\Mail; namespace EGroupware\Mail;
require_once realpath(__DIR__.'/../../api/tests/AppTest.php'); // Application test base class SaveToVfsTest extends \PHPUnit\Framework\TestCase
use Egroupware\Api;
class SaveToVfsTest extends \EGroupware\Api\AppTest
{ {
/** /**
* Create a custom status we can use to test * Create a custom status we can use to test
@ -69,7 +65,7 @@ class SaveToVfsTest extends \EGroupware\Api\AppTest
$this->assertNotContains('😂', $cleaned); $this->assertNotContains('😂', $cleaned);
// Check if the filename is not empty // Check if the filename is not empty
$this->assertGreaterThan(0, strlen($filename), 'File name is empty'); $this->assertGreaterThan(0, strlen($cleaned), 'File name is empty');
if(!$replacements) if(!$replacements)
{ {