Fixed: Size Parsing in TorrentRss was a bit too tolerant.

fixes #590
This commit is contained in:
Taloth Saldono
2015-06-04 21:08:24 +02:00
parent cd5b00afa8
commit ccff4fe142
6 changed files with 891 additions and 15 deletions
+6 -1
View File
@@ -234,11 +234,16 @@ namespace NzbDrone.Core.Indexers
return channel.Elements("item");
}
private static readonly Regex ParseSizeRegex = new Regex(@"(?<value>\d+\.\d{1,2}|\d+\,\d+\.\d{1,2}|\d+)\W?(?<unit>[KMG]i?B)",
private static readonly Regex ParseSizeRegex = new Regex(@"(?<value>(?:\d+,)*\d+(?:\.\d{1,2})?)\W?(?<unit>[KMG]i?B)(?![\w/])",
RegexOptions.IgnoreCase | RegexOptions.Compiled);
public static Int64 ParseSize(String sizeString, Boolean defaultToBinaryPrefix)
{
if (sizeString.All(char.IsDigit))
{
return Int64.Parse(sizeString);
}
var match = ParseSizeRegex.Matches(sizeString);
if (match.Count != 0)