Skip to content
This repository has been archived by the owner on Aug 19, 2024. It is now read-only.

Commit

Permalink
Merge pull request #78 from egbertbouman/fix_tdef
Browse files Browse the repository at this point in the history
Fix TorrentDef.get_length
  • Loading branch information
egbertbouman authored Jun 17, 2024
2 parents bd97671 + d8ebe09 commit 5556fbd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/tribler/core/libtorrent/torrentdef.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def pathlist2filename(pathlist: Iterable[bytes]) -> Path:
return Path(*(x.decode() for x in pathlist))


def get_length_from_metainfo(metainfo: MetainfoDict, selectedfiles: set[Path]) -> int:
def get_length_from_metainfo(metainfo: MetainfoDict, selectedfiles: set[Path] | None) -> int:
"""
Loop through all files in a torrent and calculate the total size.
"""
Expand Down Expand Up @@ -592,7 +592,7 @@ def get_length(self, selectedfiles: set[Path] | None = None) -> int:
:return: A length (long)
"""
if self.metainfo and selectedfiles is not None:
if self.metainfo:
return get_length_from_metainfo(self.metainfo, selectedfiles)
return 0

Expand Down

0 comments on commit 5556fbd

Please sign in to comment.