anacrolix / torrent

Full-featured BitTorrent client package and utilities
Mozilla Public License 2.0
5.51k stars 622 forks source link

Ignore malformed (optional) fields in metainfo.Load #910

Open sagan opened 7 months ago

sagan commented 7 months ago

Some torrents sites could generate malformed torrent file. I personally encountered that the private tracker site aidoru-online generates torrents with malformed "announce-list" fields: it incorrectly uses the comma-seperated trackers joined string instead of using the Bencode list structure.

Bittorrent clients such as qBittorrent silently ignore such malformed announce-list whening adding those torrents, and fallback to use "announce" field as tracker.

Currently, metainfo.Load return err if failed to parse any field. It will be helpful that it is be able to ignore parsing error of some optional / non-fatal fields, and still return the parsed result of other fields in such case.