diff --git a/src/NzbDrone.Core.Test/Download/DownloadClientTests/QBittorrentTests/QBittorrentFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/QBittorrentTests/QBittorrentFixture.cs index 8757e713a..fe6abc535 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 @@ public void should_return_status_with_outputdirs() 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 + { { "music", new QBittorrentLabel { Name = "music", 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 7452b3d0a..b6c56f6d8 100644 --- a/src/NzbDrone.Core/Download/Clients/QBittorrent/QBittorrent.cs +++ b/src/NzbDrone.Core/Download/Clients/QBittorrent/QBittorrent.cs @@ -375,7 +375,15 @@ public override DownloadClientInfo GetStatus() { if (Proxy.GetLabels(Settings).TryGetValue(Settings.MusicCategory, 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.MusicCategory); + savePath = savePath.Replace('/', '\\'); + } + + var labelDir = new OsPath(savePath); if (labelDir.IsRooted) {