mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 09:35:49 +02:00
Replace all unicode characters with ASCII chars in FilenameSanatizer to make filenames more sanatized
This commit is contained in:
parent
b1e03f49ee
commit
a873ad3316
1 changed files with 3 additions and 0 deletions
|
@ -36,6 +36,9 @@ class FilenameSanatizer
|
||||||
*/
|
*/
|
||||||
public static function sanitizeFilename(string $filename): string
|
public static function sanitizeFilename(string $filename): string
|
||||||
{
|
{
|
||||||
|
//Convert to ASCII
|
||||||
|
$filename = iconv('UTF-8', 'ASCII//TRANSLIT', $filename);
|
||||||
|
|
||||||
$filename = preg_replace(
|
$filename = preg_replace(
|
||||||
'~
|
'~
|
||||||
[<>:"/\\\|?*]| # file system reserved https://en.wikipedia.org/wiki/Filename#Reserved_characters_and_words
|
[<>:"/\\\|?*]| # file system reserved https://en.wikipedia.org/wiki/Filename#Reserved_characters_and_words
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue