Correctly parse backslashes from Transmission

This commit is contained in:
Jack Danger 2025-08-12 00:16:36 -07:00
parent 9ebe043bd9
commit 7089a983b5
2 changed files with 31 additions and 1 deletions

View file

@ -273,6 +273,35 @@ public void should_fix_forward_slashes()
items.First().OutputPath.Should().Be(@"C:\Downloads\Finished\transmission\" + _title);
}
[Test]
public void should_fix_backward_slashes()
{
WindowsOnly();
_downloading.DownloadDir = @"C:/Downloads/Finished/transmission";
GivenTorrents(new List<TransmissionTorrent>
{
new TransmissionTorrent
{
HashString = "HASH",
IsFinished = false,
Status = TransmissionTorrentStatus.Downloading,
Name = "Don\'t Look Back in Anger",
TotalSize = 1000,
LeftUntilDone = 100,
DownloadDir = "Can\'t touch this"
};
});
var items = Subject.GetItems().ToList();
items.Should().HaveCount(1);
items.First().OutputPath.Should().Be(
@"C:\Downloads\Finished\transmission\" + \
@"Can\'t touch this\Don't Look Back in Anger");
}
[TestCase("2.84 ()")]
[TestCase("2.84+ ()")]
[TestCase("2.84 (other info)")]

View file

@ -258,7 +258,8 @@ protected override void Test(List<ValidationFailure> failures)
protected virtual OsPath GetOutputPath(OsPath outputPath, TransmissionTorrent torrent)
{
return outputPath + torrent.Name.Replace(":", "_");
var safeName = torrent.Name.Replace(":", "_");
return outputPath + new OsPath(safeName, OsPathKind.Unknown);
}
protected string GetDownloadDirectory()