mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-11 13:02:15 +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)
|
public static function clean($filename)
|
||||||
{
|
{
|
||||||
// Replace dangerous characters with safe alternatives, maintaining meaning as much as possible.
|
// Replace dangerous characters with safe alternatives, maintaining meaning as much as possible.
|
||||||
$illegal = array('\\', '/', '<', '>', '{', '}', ':', ';', '|', '"', '~', '`', '@', '#', '$', '%', '^', '&', '*', '?');
|
$illegal = array('\\', '/', '<', '>', '{', '}', ':', ';', '|', '"', '~', '`', '$', '%', '^', '*', '?');
|
||||||
$replace = array('', '', '(', ')', '(', ')', '_', ',', '_', '', '_', '\'', '_', '_', '_', '_', '_', '_', '', '');
|
$replace = array('', '', '(', ')', '(', ')', '_', ',', '_', '', '_', '\'', '_', '_', '_', '', '');
|
||||||
$filename = str_replace($illegal, $replace, $filename);
|
$filename = str_replace($illegal, $replace, $filename);
|
||||||
|
|
||||||
// Remove control characters.
|
// Remove control characters.
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ class FilenameFilterTest extends \Codeception\TestCase\Test
|
||||||
'foo*\.bar' => 'foo.bar',
|
'foo*\.bar' => 'foo.bar',
|
||||||
'foobar{baz}.jpg' => 'foobar(baz).jpg',
|
'foobar{baz}.jpg' => 'foobar(baz).jpg',
|
||||||
'foobar^%.docx' => 'foobar_.docx',
|
'foobar^%.docx' => 'foobar_.docx',
|
||||||
|
'foo&bar@rhymix.docx' => 'foo&bar@rhymix.docx',
|
||||||
|
|
||||||
// Control characters
|
// Control characters
|
||||||
'foobar' . chr(127) . '.gif' => 'foobar.gif',
|
'foobar' . chr(127) . '.gif' => 'foobar.gif',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue