forked from extern/egroupware
fixing function and test
This commit is contained in:
parent
8950a0fd99
commit
ad95a01cec
@ -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;
|
||||||
|
@ -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)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user