mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-06-01 03:57:37 +00:00
Fixing bad file names in Windows (Fixes #2924)
This commit is contained in:
parent
d436d10b00
commit
02d273f15e
1 changed files with 3 additions and 1 deletions
|
@ -26,7 +26,9 @@ public class Util
|
|||
|
||||
public static String sanitizeFileName(final String name)
|
||||
{
|
||||
final String newName = INVALIDFILECHARS.matcher(name.toLowerCase(Locale.ENGLISH)).replaceAll("_");
|
||||
String newName = INVALIDFILECHARS.matcher(name.toLowerCase(Locale.ENGLISH)).replaceAll("_");
|
||||
if(Pattern.compile("^(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])(\\.(.+))?$", Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE | Pattern.COMMENTS).matcher(newName).matches())
|
||||
newName = "_" + newName;
|
||||
return newName;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue