rndusr / torf

Python module to create, parse and edit torrent files and magnet links

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

wrong infohash

ayasechan opened this issue · comments

the torrent file can download from https://nyaa.si/view/1284768

torf package version is 3.1.1

the infohash using torf is 95f3619484546e6735b0837e58d003cd0c93775f
but the correct value is fb8899e9faff4c0682fec40b0446cfbccbbbed18

After modifying the decode_value function of the _utils.py file as follows, I got the correct value

def decode_value(value):
    if isinstance(value, collections.abc.ByteString):
        try:
            return bytes.decode(value, encoding='utf-8', errors='strict')
        except UnicodeDecodeError:
            return value
    elif isinstance(value, collections.abc.Sequence):
        return decode_list(value)
    elif isinstance(value, collections.abc.Mapping):
        return decode_dict(value)
    else:
        return value