fix: support v2 and hybrid qBittorrent identities

This commit is contained in:
2026-07-23 11:48:08 +00:00
parent 69709c778b
commit 6ca94a546e
10 changed files with 240 additions and 74 deletions
+2 -2
View File
@@ -174,7 +174,7 @@ def _v1_files(info: dict[bytes, Any]) -> list[MetaFile]:
def _v2_files(info: dict[bytes, Any]) -> list[MetaFile]:
name = _component(info.get(b"name.utf-8", info.get(b"name")))
_component(info.get(b"name.utf-8", info.get(b"name")))
tree = info.get(b"file tree")
if not isinstance(tree, dict):
raise BencodeError("v2 metainfo has no file tree")
@@ -186,7 +186,7 @@ def _v2_files(info: dict[bytes, Any]) -> list[MetaFile]:
if not isinstance(leaf, dict):
raise BencodeError("invalid v2 file leaf")
result.append(MetaFile(
"/".join([name] + components),
"/".join(components),
_length(leaf.get(b"length")),
_padding(leaf),
))