Fix /api/v2/torrents/info to filter by hashes query parameter

Add support for the `hashes` query parameter (pipe-separated, case-insensitive)
to match real qBittorrent API behavior. This fixes compatibility with cleanuparr
and *arr apps that rely on hash-based filtering.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
John Conley 2026-03-07 17:39:42 -08:00
parent b7090eeb3a
commit c0bbab5fa4

View file

@ -164,6 +164,15 @@ public class QBittorrentController(ILogger<QBittorrentController> logger, QBitto
results = results.Where(m => m.Category == request.Category).ToList();
}
if (!String.IsNullOrWhiteSpace(request.Hashes))
{
var hashSet = new HashSet<String>(
request.Hashes.Split('|', StringSplitOptions.RemoveEmptyEntries),
StringComparer.OrdinalIgnoreCase
);
results = results.Where(m => hashSet.Contains(m.Hash)).ToList();
}
return Ok(results);
}
@ -604,6 +613,7 @@ public class QBAuthLoginRequest
public class QBTorrentsInfoRequest
{
public String? Category { get; set; }
public String? Hashes { get; set; }
}
public class QBTorrentsHashRequest