mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-08-06 04:23:02 +00:00
Sanitize mail for untoward characters.
Prevent a user error from terminating essentials timer task.
This commit is contained in:
parent
92fa415848
commit
5c19e71858
4 changed files with 25 additions and 10 deletions
|
@ -21,11 +21,17 @@ public class Util
|
|||
{
|
||||
}
|
||||
private final static Logger logger = Logger.getLogger("Minecraft");
|
||||
private final static Pattern INVALIDCHARS = Pattern.compile("[^a-z0-9]");
|
||||
private final static Pattern INVALIDFILECHARS = Pattern.compile("[^a-z0-9]");
|
||||
private final static Pattern INVALIDCHARS = Pattern.compile("[^\\p{Print}]");
|
||||
|
||||
public static String sanitizeFileName(final String name)
|
||||
{
|
||||
return INVALIDCHARS.matcher(name.toLowerCase(Locale.ENGLISH)).replaceAll("_");
|
||||
return INVALIDFILECHARS.matcher(name.toLowerCase(Locale.ENGLISH)).replaceAll("_");
|
||||
}
|
||||
|
||||
public static String sanitizeString(final String string)
|
||||
{
|
||||
return INVALIDCHARS.matcher(string).replaceAll("");
|
||||
}
|
||||
|
||||
public static String formatDateDiff(long date)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue