mirror of
https://github.com/essentials/Essentials.git
synced 2025-09-03 03:32:42 +02:00
Merge pull request #164 from chrisgward/patch-1
Fixing bad file names in Windows (Fixes #2924)
This commit is contained in:
@@ -26,7 +26,9 @@ public class Util
|
|||||||
|
|
||||||
public static String sanitizeFileName(final String name)
|
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;
|
return newName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user