Skip to content

Allow qBittorrent to determine hash ahead of time to avoid association errors#610

Merged
T4g1 merged 4 commits into
Listenarrs:canaryfrom
T4g1:fix/609-qbittorrent-hash
May 29, 2026
Merged

Allow qBittorrent to determine hash ahead of time to avoid association errors#610
T4g1 merged 4 commits into
Listenarrs:canaryfrom
T4g1:fix/609-qbittorrent-hash

Conversation

@T4g1
Copy link
Copy Markdown
Contributor

@T4g1 T4g1 commented May 21, 2026

Summary

Changes

Changed

  • Algorithm to match download in QBittorrent and Listennarr now use a more deterministic approach

Testing

  • Added a proper mock for qBittorrent API
  • Added test data framework
  • Added test on a real torrent file (public domain)

Notes

As i was not able to reproduce the issue discussed on Discord (association errors when adding torrents to qBittorrent), this might not solve the real issue but it should be an improvement nonetheless

@T4g1 T4g1 requested a review from therobbiedavis May 21, 2026 12:13
@T4g1 T4g1 self-assigned this May 21, 2026
@T4g1 T4g1 requested a review from a team May 21, 2026 12:13
@T4g1 T4g1 added the patch patch version bump - backward compatible bug fixes label May 21, 2026
Copy link
Copy Markdown
Collaborator

@therobbiedavis therobbiedavis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good for the most part. We need to clean up dead code, and I had a question about BencodeNET

Comment thread listenarr.api/Program.cs Outdated
Comment thread listenarr.infrastructure/Adapters/QbittorrentAdapter.cs Outdated
Comment thread listenarr.infrastructure/Adapters/QbittorrentAdapter.cs
Comment thread listenarr.infrastructure/Adapters/QbittorrentAdapter.cs Outdated
Comment thread Directory.Packages.props
@T4g1 T4g1 requested a review from therobbiedavis May 24, 2026 23:15
Copy link
Copy Markdown
Collaborator

@therobbiedavis therobbiedavis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job, I still have some hesitation around the cookies and url only torrent adds but I think this is looking better.

Sidenote: Let's make sure we don't commit an impermissible torrent to the repo 😆

Comment thread listenarr.api/Program.cs Outdated
Comment thread listenarr.infrastructure/Adapters/QbittorrentAdapter.cs
Comment thread listenarr.infrastructure/Adapters/QbittorrentAdapter.cs Outdated
@T4g1 T4g1 force-pushed the fix/609-qbittorrent-hash branch from 0361f69 to 85aba51 Compare May 27, 2026 13:57
Comment thread listenarr.infrastructure/Adapters/QbittorrentAdapter.cs
Comment thread listenarr.infrastructure/Adapters/QbittorrentAdapter.cs
@T4g1 T4g1 force-pushed the fix/609-qbittorrent-hash branch from cd51f91 to aff1c48 Compare May 28, 2026 17:18
@T4g1 T4g1 force-pushed the fix/609-qbittorrent-hash branch from aff1c48 to c4c6fb0 Compare May 28, 2026 17:19

private async Task<HttpResponseMessage> DoAdd(HttpRequestMessage request, CancellationToken ct)
{
if (!Authenticated)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional: The current mock accepts add requests based on a global Authenticated flag, so the tests verify login ordering but not the new cookie-propagation behavior.

@T4g1 T4g1 merged commit b85d884 into Listenarrs:canary May 29, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

patch patch version bump - backward compatible bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

qBittorrent: Trouble to link ongoing downloads with qBittorrent

2 participants