1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-10-29 23:12:39 +01:00

Fixed: Assume category path from qBittorent starting with '//' is a Windows UNC path

Radarr/Radarr#10162
This commit is contained in:
Mark McDowall 2024-07-16 21:39:40 -07:00 committed by GitHub
parent 4b5ef4907b
commit 19466aa290
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 37 additions and 1 deletions

View File

@ -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<IQBittorrentProxy>()
.Setup(v => v.GetConfig(It.IsAny<QBittorrentSettings>()))
.Returns(config);
Mocker.GetMock<IQBittorrentProxy>()
.Setup(v => v.GetApiVersion(It.IsAny<QBittorrentSettings>()))
.Returns(new Version(2, 0));
Mocker.GetMock<IQBittorrentProxy>()
.Setup(s => s.GetLabels(It.IsAny<QBittorrentSettings>()))
.Returns(new Dictionary<string, QBittorrentLabel>
{ { "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()
{

View File

@ -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)
{