MinimumNumberFromRange exception (#222)
* More regex! Bonus is now a keyword for specials * Regex enhancement, Sort chapters on next/prev chapter to ensure they always in proper order, and don't set JWT on starup when in development mode. * Fixes KAVITA-H. Check to ensure non numeric characters are not in range string before attempting to parse a float out.
This commit is contained in:
parent
308e2b48a0
commit
77c52717ce
2 changed files with 6 additions and 0 deletions
|
@ -799,6 +799,10 @@ namespace API.Parser
|
|||
|
||||
public static float MinimumNumberFromRange(string range)
|
||||
{
|
||||
if (!Regex.IsMatch(range, @"^[\d-.]+$"))
|
||||
{
|
||||
return (float) 0.0;
|
||||
}
|
||||
var tokens = range.Replace("_", string.Empty).Split("-");
|
||||
return tokens.Min(float.Parse);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue