mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-09 04:22:30 +01:00
Fixed: Incorrect imports with Vuze when torrent contains a single file. (#1470)
This commit is contained in:
parent
494ef16735
commit
9e84b4a782
@ -294,7 +294,7 @@ public void should_fail_with_unsupported_protocol_version(string version)
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_have_correct_output_directory()
|
||||
public void should_have_correct_output_directory_for_multifile_torrents()
|
||||
{
|
||||
WindowsOnly();
|
||||
|
||||
@ -311,5 +311,25 @@ public void should_have_correct_output_directory()
|
||||
items.First().OutputPath.Should().Be(@"C:\Downloads\" + _title);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_have_correct_output_directory_for_singlefile_torrents()
|
||||
{
|
||||
WindowsOnly();
|
||||
|
||||
var fileName = _title + ".mkv";
|
||||
_downloading.Name = fileName;
|
||||
_downloading.DownloadDir = @"C:/Downloads";
|
||||
|
||||
GivenTorrents(new List<TransmissionTorrent>
|
||||
{
|
||||
_downloading
|
||||
});
|
||||
|
||||
var items = Subject.GetItems().ToList();
|
||||
|
||||
items.Should().HaveCount(1);
|
||||
items.First().OutputPath.Should().Be(@"C:\Downloads\" + fileName);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -26,7 +26,19 @@ public Vuze(ITransmissionProxy proxy,
|
||||
|
||||
protected override OsPath GetOutputPath(OsPath outputPath, TransmissionTorrent torrent)
|
||||
{
|
||||
_logger.Debug("Vuze output directory: {0}", outputPath);
|
||||
// Vuze has similar behavior as uTorrent:
|
||||
// - A multi-file torrent is downloaded in a job folder and 'outputPath' points to that directory directly.
|
||||
// - A single-file torrent is downloaded in the root folder and 'outputPath' poinst to that root folder.
|
||||
// We have to make sure the return value points to the job folder OR file.
|
||||
if (outputPath == null || outputPath.FileName == torrent.Name)
|
||||
{
|
||||
_logger.Trace("Vuze output directory: {0}", outputPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
outputPath = outputPath + torrent.Name;
|
||||
_logger.Trace("Vuze output file: {0}", outputPath);
|
||||
}
|
||||
|
||||
return outputPath;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user