From ad95a01cecd6731cae78cdaa4cb9e0ce8d7b152b Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 11 Apr 2018 14:05:49 +0200 Subject: [PATCH] fixing function and test --- api/src/Mail.php | 2 +- mail/tests/SaveToVfsTest.php | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/api/src/Mail.php b/api/src/Mail.php index 4183bb636f..bf6be9a7c4 100644 --- a/api/src/Mail.php +++ b/api/src/Mail.php @@ -6447,7 +6447,7 @@ class Mail */ 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)); if (empty($file)) $file = lang('empty'); return $file; diff --git a/mail/tests/SaveToVfsTest.php b/mail/tests/SaveToVfsTest.php index ec5d066132..236e6ef090 100644 --- a/mail/tests/SaveToVfsTest.php +++ b/mail/tests/SaveToVfsTest.php @@ -13,11 +13,7 @@ namespace EGroupware\Mail; -require_once realpath(__DIR__.'/../../api/tests/AppTest.php'); // Application test base - -use Egroupware\Api; - -class SaveToVfsTest extends \EGroupware\Api\AppTest +class SaveToVfsTest extends \PHPUnit\Framework\TestCase { /** * Create a custom status we can use to test @@ -69,7 +65,7 @@ class SaveToVfsTest extends \EGroupware\Api\AppTest $this->assertNotContains('😂', $cleaned); // 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) {