[TB] fix: moving hash dir files too far up

This commit is contained in:
Sam Heinz 2025-03-16 20:32:00 +10:00
parent 9d57466472
commit bd96795f34
2 changed files with 9 additions and 3 deletions

View file

@ -353,14 +353,20 @@ public class TorBoxTorrentClient(ILogger<TorBoxTorrentClient> logger, IHttpClien
return Map(result!);
}
public static void MoveHashDirectoryUpTB(String extractPath, Torrent _torrent)
public static void MoveHashDirContents(String extractPath, Torrent _torrent)
{
var hashDir = Path.Combine(extractPath, _torrent.Hash);
if (Directory.Exists(hashDir))
{
var innerFolder = Directory.GetDirectories(hashDir)[0];
if (!Path.GetFileName(innerFolder).Equals(_torrent.Hash, StringComparison.CurrentCultureIgnoreCase))
{
innerFolder = hashDir;
}
foreach (var file in Directory.GetFiles(innerFolder))
{
var destFile = Path.Combine(extractPath, Path.GetFileName(file));

View file

@ -106,7 +106,7 @@ public class UnpackClient(Download download, String destinationPath)
if (Settings.Get.Provider.Provider == Data.Enums.Provider.TorBox)
{
TorBoxTorrentClient.MoveHashDirectoryUpTB(extractPath, _torrent);
TorBoxTorrentClient.MoveHashDirContents(extractPath, _torrent);
}
}
catch (Exception ex)