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

IndexError: list index out of range - get_files_completion #7106

Closed
sentry-for-tribler bot opened this issue Oct 25, 2022 · 1 comment · Fixed by #7114
Closed

IndexError: list index out of range - get_files_completion #7106

sentry-for-tribler bot opened this issue Oct 25, 2022 · 1 comment · Fixed by #7114
Assignees
Milestone

Comments

@sentry-for-tribler
Copy link

Sentry Issue: TRIBLER-TE

IndexError: list index out of range
  File "tribler\core\components\restapi\rest\rest_manager.py", line 50, in error_middleware
  File "aiohttp\web_middlewares.py", line 117, in impl
  File "tribler\core\components\libtorrent\restapi\downloads_endpoint.py", line 351, in get_downloads
  File "tribler\core\components\libtorrent\restapi\downloads_endpoint.py", line 155, in get_files_info_json
  File "tribler\core\components\libtorrent\download_manager\download_state.py", line 172, in get_files_completion
@xoriole
Copy link
Contributor

xoriole commented Oct 25, 2022

if self.lt_status and self.download.handle and self.download.handle.is_valid():
files = self.download.get_def().get_files_with_length()
progress = self.download.handle.file_progress(flags=1)
for index, (path, size) in enumerate(files):
completion_frac = (float(progress[index]) / size) if size > 0 else 1
completion.append((path, completion_frac))

Seems handle.file_progress(flags=1) can return empty list [] even though there are files present in the torrent.

@xoriole xoriole added this to the 7.13.0 milestone Oct 25, 2022
@xoriole xoriole self-assigned this Oct 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant