diff --git a/src/NzbDrone.Core.Test/Download/DownloadClientTests/QBittorrentTests/QBittorrentFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/QBittorrentTests/QBittorrentFixture.cs index 3f58b0205..ef7161ef5 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadClientTests/QBittorrentTests/QBittorrentFixture.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadClientTests/QBittorrentTests/QBittorrentFixture.cs @@ -559,6 +559,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 + { { "movies-radarr", new QBittorrentLabel { Name = "movies-radarr", 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 c4d3841df..62fc68e54 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.MovieCategory, 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.MovieCategory); + savePath = savePath.Replace('/', '\\'); + } + + var labelDir = new OsPath(savePath); if (labelDir.IsRooted) {