mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-22 05:15:29 +09:00
Fix incorrect encoding of filenames with single quotes
This commit is contained in:
parent
0a92627c8a
commit
44608bbe90
2 changed files with 7 additions and 7 deletions
|
|
@ -15,6 +15,9 @@ class FilenameFilter
|
|||
*/
|
||||
public static function clean(string $filename): string
|
||||
{
|
||||
// Clean up unnecessary encodings.
|
||||
$filename = strtr($filename, ['&' => '&', ''' => "'"]);
|
||||
|
||||
// Replace dangerous characters with safe alternatives, maintaining meaning as much as possible.
|
||||
$illegal = array('\\', '/', '<', '>', '{', '}', ':', ';', '|', '"', '~', '`', '$', '%', '^', '*', '?');
|
||||
$replace = array('', '', '(', ')', '(', ')', '_', ',', '_', '', '_', '\'', '_', '_', '_', '', '');
|
||||
|
|
@ -31,9 +34,6 @@ class FilenameFilter
|
|||
$filename = preg_replace('/__+/', '_', $filename);
|
||||
$filename = preg_replace('/\.\.+/', '.', $filename);
|
||||
|
||||
// Clean up unnecessary encodings.
|
||||
$filename = strtr($filename, array('&' => '&'));
|
||||
|
||||
// Change .php files to .phps to make them non-executable.
|
||||
if (strtolower(substr($filename, strlen($filename) - 4)) === '.php')
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue