mirror of
https://github.com/lidarr/Lidarr
synced 2024-12-22 07:42:28 +00:00
Fixed: Assume category path from qBittorent starting with '//' is a Windows UNC path
* Fixed: Assume category path from qBittorent starting with '//' is a Windows UNC path Radarr/Radarr#10162 (cherry picked from commit 19466aa29050e1b13b1db8cc61662b10d76a82e4) * fixup! Fixed: Assume category path from qBittorent starting with '//' is a Windows UNC path --------- Co-authored-by: Mark McDowall <mark@mcdowall.ca> Co-authored-by: Bogdan <mynameisbogdan@users.noreply.github.com>
This commit is contained in:
parent
2328611472
commit
d845d73130
2 changed files with 37 additions and 1 deletions
|
@ -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<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>
|
||||
{ { "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()
|
||||
{
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue