diff --git a/src/NzbDrone.Core.Test/Download/DownloadClientTests/QBittorrentTests/QBittorrentFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/QBittorrentTests/QBittorrentFixture.cs index 1d04855b5..4b126835b 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadClientTests/QBittorrentTests/QBittorrentFixture.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadClientTests/QBittorrentTests/QBittorrentFixture.cs @@ -560,6 +560,34 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.QBittorrentTests result.OutputRootFolders.First().Should().Be(@"C:\Downloads\Finished\QBittorrent".AsOsAgnostic()); } + [Test] + public void should_correct_category_output_path() + { + var config = new QBittorrentPreferences + { + SavePath = @"C:\Downloads\Finished\QBittorrent".AsOsAgnostic() + }; + + Mocker.GetMock() + .Setup(v => v.GetConfig(It.IsAny())) + .Returns(config); + + Mocker.GetMock() + .Setup(v => v.GetApiVersion(It.IsAny())) + .Returns(new Version(2, 0)); + + Mocker.GetMock() + .Setup(s => s.GetLabels(It.IsAny())) + .Returns(new Dictionary + { { "tv", new QBittorrentLabel { Name = "tv", SavePath = "//server/store/downloads" } } }); + + var result = Subject.GetStatus(); + + result.IsLocalhost.Should().BeTrue(); + result.OutputRootFolders.Should().NotBeNull(); + result.OutputRootFolders.First().Should().Be(@"\\server\store\downloads"); + } + [Test] public async Task Download_should_handle_http_redirect_to_magnet() { diff --git a/src/NzbDrone.Core/Download/Clients/QBittorrent/QBittorrent.cs b/src/NzbDrone.Core/Download/Clients/QBittorrent/QBittorrent.cs index cea3a8c8b..bf1d1a14f 100644 --- a/src/NzbDrone.Core/Download/Clients/QBittorrent/QBittorrent.cs +++ b/src/NzbDrone.Core/Download/Clients/QBittorrent/QBittorrent.cs @@ -377,7 +377,15 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent { if (Proxy.GetLabels(Settings).TryGetValue(Settings.TvCategory, out var label) && label.SavePath.IsNotNullOrWhiteSpace()) { - var labelDir = new OsPath(label.SavePath); + var savePath = label.SavePath; + + if (savePath.StartsWith("//")) + { + _logger.Trace("Replacing double forward slashes in path '{0}'. If this is not meant to be a Windows UNC path fix the 'Save Path' in qBittorrent's {1} category", savePath, Settings.TvCategory); + savePath = savePath.Replace('/', '\\'); + } + + var labelDir = new OsPath(savePath); if (labelDir.IsRooted) {