diff --git a/SharedLibraryCore/Commands/NativeCommands.cs b/SharedLibraryCore/Commands/NativeCommands.cs index ae2879c6..e04e695d 100644 --- a/SharedLibraryCore/Commands/NativeCommands.cs +++ b/SharedLibraryCore/Commands/NativeCommands.cs @@ -229,7 +229,7 @@ namespace SharedLibraryCore.Commands /// public class TempBanCommand : Command { - private static readonly string TempBanRegex = @"([0-9]+\w+)\ (.+)"; + private static readonly string TempBanRegex = @"^([0-9]{1,5}\p{L}+)\ (.+)"; private readonly ApplicationConfiguration _appConfig; public TempBanCommand(ApplicationConfiguration appConfig, CommandConfiguration config, diff --git a/SharedLibraryCore/Utilities.cs b/SharedLibraryCore/Utilities.cs index ee47a773..08166367 100644 --- a/SharedLibraryCore/Utilities.cs +++ b/SharedLibraryCore/Utilities.cs @@ -510,7 +510,7 @@ namespace SharedLibraryCore public static TimeSpan ParseTimespan(this string input) { - var expressionMatch = Regex.Match(input, @"([0-9]+)(\w+)"); + var expressionMatch = Regex.Match(input, @"^([0-9]{1,5})(\p{L}+)"); if (!expressionMatch.Success) // fallback to default tempban length of 1 hour { diff --git a/WebfrontCore/Controllers/ActionController.cs b/WebfrontCore/Controllers/ActionController.cs index 338e62fa..8e8d761d 100644 --- a/WebfrontCore/Controllers/ActionController.cs +++ b/WebfrontCore/Controllers/ActionController.cs @@ -312,8 +312,8 @@ namespace WebfrontCore.Controllers else { var durationSpan = _appConfig.BanDurations[duration - 1]; - var durationValue = durationSpan.TotalHours.ToString(CultureInfo.InvariantCulture) + - Localization["GLOBAL_TIME_HOURS"][0]; + var durationValue = durationSpan.TotalMinutes.ToString(CultureInfo.InvariantCulture) + + Localization["GLOBAL_TIME_MINUTES"][0]; command = $"{_appConfig.CommandPrefix}{_tempbanCommandName} @{targetId} {durationValue} {fallthroughReason}"; }