fix: sanitize RdName in TorBox MoveHashDirContents
UnpackClient now sanitizes the torrent directory name when building extractPath, so the post-unpack TorBox move needs to compare against the sanitized name as well. Without this, extractPath.EndsWith(rdName) takes the wrong branch for any torrent whose RdName contained brackets and files end up in the hash subdirectory instead of the torrent directory. Reported by @omgbeez.
This commit is contained in:
parent
36333162a8
commit
541489d0d3
1 changed files with 6 additions and 2 deletions
|
|
@ -610,9 +610,13 @@ public class TorBoxDebridClient(ILogger<TorBoxDebridClient> logger, IHttpClientF
|
|||
{
|
||||
var innerFolder = Directory.GetDirectories(hashDir)[0];
|
||||
|
||||
// extractPath may have been sanitized by FilenameSanitizer when the torrent
|
||||
// directory was created, so compare against the sanitized RdName too.
|
||||
var rdName = FilenameSanitizer.SanitizeFilenameIfEnabled(torrent.RdName!);
|
||||
|
||||
var moveDir = extractPath;
|
||||
|
||||
if (!extractPath.EndsWith(torrent.RdName!))
|
||||
if (!extractPath.EndsWith(rdName))
|
||||
{
|
||||
moveDir = hashDir;
|
||||
}
|
||||
|
|
@ -629,7 +633,7 @@ public class TorBoxDebridClient(ILogger<TorBoxDebridClient> logger, IHttpClientF
|
|||
Directory.Move(dir, destDir);
|
||||
}
|
||||
|
||||
if (!extractPath.Contains(torrent.RdName!))
|
||||
if (!extractPath.Contains(rdName))
|
||||
{
|
||||
Directory.Delete(innerFolder, true);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue