Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Results wrap when using limit+offset on torrents/info API #22158

Open
rossengeorgiev opened this issue Jan 12, 2025 · 0 comments · May be fixed by #22174
Open

Results wrap when using limit+offset on torrents/info API #22158

rossengeorgiev opened this issue Jan 12, 2025 · 0 comments · May be fixed by #22174
Labels
WebAPI WebAPI-related issues/changes

Comments

@rossengeorgiev
Copy link

qBittorrent & operating system versions

qBittorrent: v5.0.3 amd64
Package: qbittorent-nox
Operating system: Ubuntu 24.10

What is the problem?

Tried using limit/offset to implement pagination in a script, and discovered the results wrap around. I expected that the result would be empty when I set the offset past the total number of results, but instead the results wrap around.

Steps to reproduce

  1. Create category with 10 torrents
  2. GET /api/v2/torrents/info?limit=10&category=Example&offset=0 - 10 results as expected
  3. GET /api/v2/torrents/info?limit=10&category=Example&offset=10 - 10 results repeated, expected no results
  4. GET /api/v2/torrents/info?limit=10&category=Example&offset=20 - 10 results repeated, expected no results

An even easier way to replicate is using limit=1 and incrementing the offset by 1. This will produce results forever. It seems the only way to detect reaching the end is to keep track of previously seen results.

Additional context

No response

Log(s) & preferences file(s)

not relevant

@thalieht thalieht added the WebAPI WebAPI-related issues/changes label Jan 13, 2025
@userwiths userwiths linked a pull request Jan 17, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WebAPI WebAPI-related issues/changes
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants