filter invalid chars

This commit is contained in:
cyn0x8 2025-01-17 16:29:58 -08:00
parent 1a1d50b036
commit da0d6eecb5
No known key found for this signature in database
GPG key ID: 56FB777DD9A4B6B0

View file

@ -984,6 +984,11 @@ class FileUtilSandboxed
path = path.substring(1);
}
for (char in INVALID_CHARS)
{
path = path.replace(char, '');
}
var parts:Array<String> = path.split('/');
var sanitized:Array<String> = [];
for (part in parts)
@ -1020,6 +1025,11 @@ class FileUtilSandboxed
'lime.ndll'
];
/**
* Characters which are invalid in the file system.
*/
private static final INVALID_CHARS:Array<String> = [':', '*', '?', '"', '<', '>', '|'];
/**
* Check against protected paths.
* @param path The path to check.