From a19bcf96833ec5dd7d2db1ab96de9a7a3ff48603 Mon Sep 17 00:00:00 2001 From: ta264 Date: Tue, 12 May 2020 21:43:08 +0100 Subject: [PATCH] Fixed: CustomFormat size specs in already grabbed check Sizes need to be parsed as a long not an int else anything with a size > 2GiB will fail to be parsed and be set with size 0 Fixes #4262 --- .../AugmentersTests/AugmentWithHistoryFixture.cs | 4 ++-- .../CustomFormats/CustomFormatCalculationService.cs | 2 +- src/NzbDrone.Core/Parser/Augmenters/AugmentWithHistory.cs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/NzbDrone.Core.Test/ParserTests/ParsingServiceTests/AugmentersTests/AugmentWithHistoryFixture.cs b/src/NzbDrone.Core.Test/ParserTests/ParsingServiceTests/AugmentersTests/AugmentWithHistoryFixture.cs index 75b92c7b8..d76c68a6e 100644 --- a/src/NzbDrone.Core.Test/ParserTests/ParsingServiceTests/AugmentersTests/AugmentWithHistoryFixture.cs +++ b/src/NzbDrone.Core.Test/ParserTests/ParsingServiceTests/AugmentersTests/AugmentWithHistoryFixture.cs @@ -80,9 +80,9 @@ public void should_add_indexer_flags() [Test] public void should_add_size() { - var history = HistoryWithData("Size", 1500.ToString()); + var history = HistoryWithData("Size", 9663676416.ToString()); var movieInfo = Subject.AugmentMovieInfo(MovieInfo, history); - movieInfo.ExtraInfo["Size"].Should().BeEquivalentTo(1500); + movieInfo.ExtraInfo["Size"].Should().BeEquivalentTo(9663676416); } [Test] diff --git a/src/NzbDrone.Core/CustomFormats/CustomFormatCalculationService.cs b/src/NzbDrone.Core/CustomFormats/CustomFormatCalculationService.cs index 2a3eb48a9..8ff472528 100644 --- a/src/NzbDrone.Core/CustomFormats/CustomFormatCalculationService.cs +++ b/src/NzbDrone.Core/CustomFormats/CustomFormatCalculationService.cs @@ -120,7 +120,7 @@ public List ParseCustomFormat(MovieHistory history) var parsed = _parsingService.ParseMovieInfo(history.SourceTitle, null); Enum.TryParse(history.Data.GetValueOrDefault("indexerFlags"), true, out IndexerFlags flags); - int.TryParse(history.Data.GetValueOrDefault("size"), out var size); + long.TryParse(history.Data.GetValueOrDefault("size"), out var size); var info = new ParsedMovieInfo { diff --git a/src/NzbDrone.Core/Parser/Augmenters/AugmentWithHistory.cs b/src/NzbDrone.Core/Parser/Augmenters/AugmentWithHistory.cs index 9ad19e56a..c0530ffb2 100644 --- a/src/NzbDrone.Core/Parser/Augmenters/AugmentWithHistory.cs +++ b/src/NzbDrone.Core/Parser/Augmenters/AugmentWithHistory.cs @@ -40,7 +40,7 @@ public ParsedMovieInfo AugmentMovieInfo(ParsedMovieInfo movieInfo, object helper releaseInfo.IndexerId = indexerId; } - if (int.TryParse(history.Data.GetValueOrDefault("size"), out var size)) + if (long.TryParse(history.Data.GetValueOrDefault("size"), out var size)) { releaseInfo.Size = size; }