From 6054dd8ee6281126d20f3082ef6f9b6e8c322287 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Mon, 26 Jan 2015 22:29:18 -0800 Subject: [PATCH] Fixed: Don't scan subfolders in series folders that start with a period --- .../DiskScanServiceTests/ScanFixture.cs | 19 +++++++++++++++++++ .../MediaFiles/DiskScanService.cs | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/NzbDrone.Core.Test/MediaFiles/DiskScanServiceTests/ScanFixture.cs b/src/NzbDrone.Core.Test/MediaFiles/DiskScanServiceTests/ScanFixture.cs index 094e00b59..8982e441d 100644 --- a/src/NzbDrone.Core.Test/MediaFiles/DiskScanServiceTests/ScanFixture.cs +++ b/src/NzbDrone.Core.Test/MediaFiles/DiskScanServiceTests/ScanFixture.cs @@ -143,5 +143,24 @@ public void should_scan_extras_series_and_subfolders() Mocker.GetMock() .Verify(v => v.GetImportDecisions(It.Is>(l => l.Count == 4), _series, false, (QualityModel)null), Times.Once()); } + + [Test] + public void should_not_scan_subfolders_that_start_with_period() + { + GivenParentFolderExists(); + + GivenFiles(new List + { + Path.Combine(_series.Path, ".@__thumb", "file1.mkv").AsOsAgnostic(), + Path.Combine(_series.Path, ".@__THUMB", "file2.mkv").AsOsAgnostic(), + Path.Combine(_series.Path, ".hidden", "file2.mkv").AsOsAgnostic(), + Path.Combine(_series.Path, "Season 1", "s01e01.mkv").AsOsAgnostic() + }); + + Subject.Scan(_series); + + Mocker.GetMock() + .Verify(v => v.GetImportDecisions(It.Is>(l => l.Count == 1), _series, false, (QualityModel)null), Times.Once()); + } } } diff --git a/src/NzbDrone.Core/MediaFiles/DiskScanService.cs b/src/NzbDrone.Core/MediaFiles/DiskScanService.cs index 56f46c823..f3f2bab99 100644 --- a/src/NzbDrone.Core/MediaFiles/DiskScanService.cs +++ b/src/NzbDrone.Core/MediaFiles/DiskScanService.cs @@ -57,7 +57,7 @@ public DiskScanService(IDiskProvider diskProvider, _logger = logger; } - private static readonly Regex ExcludedSubFoldersRegex = new Regex(@"(extras|\.appledouble)(?:\\|\/)", RegexOptions.Compiled | RegexOptions.IgnoreCase); + private static readonly Regex ExcludedSubFoldersRegex = new Regex(@"(extras|^\..+)(?:\\|\/)", RegexOptions.Compiled | RegexOptions.IgnoreCase); public void Scan(Series series) {