mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-08 03:01:43 +09:00
Do not remove @, #, & from attached file names
This commit is contained in:
parent
f692d223f2
commit
61a6c01d26
2 changed files with 3 additions and 2 deletions
|
|
@ -16,8 +16,8 @@ class FilenameFilter
|
|||
public static function clean($filename)
|
||||
{
|
||||
// Replace dangerous characters with safe alternatives, maintaining meaning as much as possible.
|
||||
$illegal = array('\\', '/', '<', '>', '{', '}', ':', ';', '|', '"', '~', '`', '@', '#', '$', '%', '^', '&', '*', '?');
|
||||
$replace = array('', '', '(', ')', '(', ')', '_', ',', '_', '', '_', '\'', '_', '_', '_', '_', '_', '_', '', '');
|
||||
$illegal = array('\\', '/', '<', '>', '{', '}', ':', ';', '|', '"', '~', '`', '$', '%', '^', '*', '?');
|
||||
$replace = array('', '', '(', ')', '(', ')', '_', ',', '_', '', '_', '\'', '_', '_', '_', '', '');
|
||||
$filename = str_replace($illegal, $replace, $filename);
|
||||
|
||||
// Remove control characters.
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ class FilenameFilterTest extends \Codeception\TestCase\Test
|
|||
'foo*\.bar' => 'foo.bar',
|
||||
'foobar{baz}.jpg' => 'foobar(baz).jpg',
|
||||
'foobar^%.docx' => 'foobar_.docx',
|
||||
'foo&bar@rhymix.docx' => 'foo&bar@rhymix.docx',
|
||||
|
||||
// Control characters
|
||||
'foobar' . chr(127) . '.gif' => 'foobar.gif',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue