diff --git a/NzbDrone.Core.Test/ProviderTests/DownloadClientTests/BlackholeProviderFixture.cs b/NzbDrone.Core.Test/ProviderTests/DownloadClientTests/BlackholeProviderFixture.cs index 0f8a5be95..ec867c3ac 100644 --- a/NzbDrone.Core.Test/ProviderTests/DownloadClientTests/BlackholeProviderFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/DownloadClientTests/BlackholeProviderFixture.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Net; using System.Text; @@ -67,6 +68,15 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests ExceptionVerification.ExpectedWarns(1); } + [Test] + public void should_replace_illegal_characters_in_title() + { + var illegalTitle = "Saturday Night Live - S38E08 - Jeremy Renner/Maroon 5 [SDTV]"; + var expectedFilename = Path.Combine(blackHoleFolder, "Saturday Night Live - S38E08 - Jeremy Renner+Maroon 5 [SDTV].nzb"); + Mocker.Resolve().DownloadNzb(nzbUrl, illegalTitle).Should().BeTrue(); + + Mocker.GetMock().Verify(c => c.DownloadFile(It.IsAny(), expectedFilename), Times.Once()); + } } } diff --git a/NzbDrone.Core.Test/ProviderTests/DownloadClientTests/PneumaticProviderFixture.cs b/NzbDrone.Core.Test/ProviderTests/DownloadClientTests/PneumaticProviderFixture.cs index 293b7697e..540389362 100644 --- a/NzbDrone.Core.Test/ProviderTests/DownloadClientTests/PneumaticProviderFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/DownloadClientTests/PneumaticProviderFixture.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Net; using System.Text; @@ -75,5 +76,16 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests { Mocker.Resolve().DownloadNzb(nzbUrl, "30 Rock - Season 1").Should().BeFalse(); } + + [Test] + public void should_replace_illegal_characters_in_title() + { + var illegalTitle = "Saturday Night Live - S38E08 - Jeremy Renner/Maroon 5 [SDTV]"; + var expectedFilename = Path.Combine(pneumaticFolder, "Saturday Night Live - S38E08 - Jeremy Renner+Maroon 5 [SDTV].nzb"); + + Mocker.Resolve().DownloadNzb(nzbUrl, illegalTitle).Should().BeTrue(); + + Mocker.GetMock().Verify(c => c.DownloadFile(It.IsAny(), expectedFilename), Times.Once()); + } } } diff --git a/NzbDrone.Core/Providers/DownloadClients/BlackholeProvider.cs b/NzbDrone.Core/Providers/DownloadClients/BlackholeProvider.cs index 836501ffb..af836cb65 100644 --- a/NzbDrone.Core/Providers/DownloadClients/BlackholeProvider.cs +++ b/NzbDrone.Core/Providers/DownloadClients/BlackholeProvider.cs @@ -38,6 +38,8 @@ namespace NzbDrone.Core.Providers.DownloadClients { try { + title = MediaFileProvider.CleanFilename(title); + var filename = Path.Combine(_configProvider.BlackholeDirectory, title + ".nzb"); if (_diskProvider.FileExists(filename)) @@ -64,7 +66,5 @@ namespace NzbDrone.Core.Providers.DownloadClients { return !_upgradeHistorySpecification.IsSatisfiedBy(newParseResult); } - - } } diff --git a/NzbDrone.Core/Providers/DownloadClients/PneumaticProvider.cs b/NzbDrone.Core/Providers/DownloadClients/PneumaticProvider.cs index 0a6e557dd..45d9acd2e 100644 --- a/NzbDrone.Core/Providers/DownloadClients/PneumaticProvider.cs +++ b/NzbDrone.Core/Providers/DownloadClients/PneumaticProvider.cs @@ -44,6 +44,8 @@ namespace NzbDrone.Core.Providers.DownloadClients return false; } + title = MediaFileProvider.CleanFilename(title); + //Save to the Pneumatic directory (The user will need to ensure its accessible by XBMC) var filename = Path.Combine(_configProvider.PneumaticDirectory, title + ".nzb");