From 66aae0c91cd5ac6614c6b54c8e4f9137404025b8 Mon Sep 17 00:00:00 2001 From: Bogdan Date: Mon, 3 Feb 2025 22:57:42 +0200 Subject: [PATCH] Fixed: Reject multi-part files with P1, P2, etc. --- .../NotMultiPartSpecificationFixture.cs | 11 +++++++++++ .../Specifications/NotMultiPartSpecification.cs | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/NzbDrone.Core.Test/MediaFiles/MovieImport/Specifications/NotMultiPartSpecificationFixture.cs b/src/NzbDrone.Core.Test/MediaFiles/MovieImport/Specifications/NotMultiPartSpecificationFixture.cs index 7331605499..0a91afe98f 100644 --- a/src/NzbDrone.Core.Test/MediaFiles/MovieImport/Specifications/NotMultiPartSpecificationFixture.cs +++ b/src/NzbDrone.Core.Test/MediaFiles/MovieImport/Specifications/NotMultiPartSpecificationFixture.cs @@ -54,6 +54,17 @@ public void should_be_accepted_for_legitimate_files(object[] paths) @"C:\Test\Downloaded\Bad Boys (2006) part1.mkv", @"C:\Test\Downloaded\Bad Boys (2006) part2.mkv" })] + + [TestCase(new object[] + { + @"C:\Test\Downloaded\Bad Boys (2006) pt1.mkv", + @"C:\Test\Downloaded\Bad Boys (2006) pt2.mkv" + })] + [TestCase(new object[] + { + @"C:\Test\Downloaded\Bad Boys (2006) P1.mkv", + @"C:\Test\Downloaded\Bad Boys (2006) P2.mkv" + })] [TestCase(new object[] { @"C:\Test\Downloaded\blah blah - cd 1.mvk", diff --git a/src/NzbDrone.Core/MediaFiles/MovieImport/Specifications/NotMultiPartSpecification.cs b/src/NzbDrone.Core/MediaFiles/MovieImport/Specifications/NotMultiPartSpecification.cs index a6694a8bca..ead4680cc1 100644 --- a/src/NzbDrone.Core/MediaFiles/MovieImport/Specifications/NotMultiPartSpecification.cs +++ b/src/NzbDrone.Core/MediaFiles/MovieImport/Specifications/NotMultiPartSpecification.cs @@ -12,8 +12,8 @@ public class NotMultiPartSpecification : IImportDecisionEngineSpecification { private static readonly Regex[] MovieMultiPartRegex = new[] { - new Regex(@"(?[ _.-]*(?:cd|dvd|p(?:ar)?t|dis[ck])[ _.-]*[0-9]+)", RegexOptions.Compiled | RegexOptions.IgnoreCase), - new Regex(@"(?[ _.-]*(?:cd|dvd|p(?:ar)?t|dis[ck])[ _.-]*[a-d]+)", RegexOptions.Compiled | RegexOptions.IgnoreCase), + new Regex(@"(?[ _.-]*(?:cd|dvd|p(?:(?:ar)?t)?|dis[ck])[ _.-]*[0-9]+)", RegexOptions.Compiled | RegexOptions.IgnoreCase), + new Regex(@"(?[ _.-]*(?:cd|dvd|p(?:(?:ar)?t)?|dis[ck])[ _.-]*[a-d]+)", RegexOptions.Compiled | RegexOptions.IgnoreCase), }; private readonly IDiskProvider _diskProvider;