fix: Fix invalid download path with single-file torrents
This commit is contained in:
parent
0026541dca
commit
268bb6826c
1 changed files with 16 additions and 0 deletions
|
|
@ -43,6 +43,14 @@ public static class DownloadHelper
|
|||
subPath = subPath.Trim('/').Trim('\\');
|
||||
|
||||
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('\\');
|
||||
|
||||
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