Merge pull request #651 from Sculas/fix/path-single-file-torrent
fix: Fix invalid download path with single-file torrents
This commit is contained in:
commit
e700939cfa
1 changed files with 16 additions and 0 deletions
|
|
@ -43,6 +43,14 @@ public static class DownloadHelper
|
||||||
subPath = subPath.Trim('/').Trim('\\');
|
subPath = subPath.Trim('/').Trim('\\');
|
||||||
|
|
||||||
torrentPath = Path.Combine(torrentPath, subPath);
|
torrentPath = Path.Combine(torrentPath, subPath);
|
||||||
|
} else if (torrent.Files.Count == 1)
|
||||||
|
{
|
||||||
|
if (directory != fileName)
|
||||||
|
{
|
||||||
|
throw new($"Torrent path {torrentPath} does not match file name {fileName}. This is a requirement for single file torrents.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return torrentPath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -90,6 +98,14 @@ public static class DownloadHelper
|
||||||
subPath = subPath.Trim('/').Trim('\\');
|
subPath = subPath.Trim('/').Trim('\\');
|
||||||
|
|
||||||
torrentPath = Path.Combine(torrentPath, subPath);
|
torrentPath = Path.Combine(torrentPath, subPath);
|
||||||
|
} else if (torrent.Files.Count == 1)
|
||||||
|
{
|
||||||
|
if (torrentPath != fileName)
|
||||||
|
{
|
||||||
|
throw new($"Torrent path {torrentPath} does not match file name {fileName}. This is a requirement for single file torrents.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return torrentPath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue