)
type MetaInfo struct {
- InfoBytes bencode.Bytes `bencode:"info,omitempty"` // BEP 3
- Announce string `bencode:"announce,omitempty"` // BEP 3
- AnnounceList AnnounceList `bencode:"announce-list,omitempty"` // BEP 12
- Nodes []Node `bencode:"nodes,omitempty"` // BEP 5
+ InfoBytes bencode.Bytes `bencode:"info,omitempty"` // BEP 3
+ Announce string `bencode:"announce,omitempty"` // BEP 3
+ AnnounceList AnnounceList `bencode:"announce-list,omitempty"` // BEP 12
+ Nodes []Node `bencode:"nodes,omitempty,ignore_unmarshal_type_error"` // BEP 5
// Where's this specified? Mentioned at
// https://wiki.theory.org/index.php/BitTorrentSpecification: (optional) the creation time of
// the torrent, in standard UNIX epoch format (integer, seconds since 1-Jan-1970 00:00:00 UTC)
var mi MetaInfo
assert.NoError(t, bencode.Unmarshal([]byte("d13:creation date23:29.03.2018 22:18:14 UTC4:infodee"), &mi))
}
+
+// See https://github.com/anacrolix/torrent/issues/843.
+func TestUnmarshalEmptyStringNodes(t *testing.T) {
+ var mi MetaInfo
+ c := qt.New(t)
+ err := bencode.Unmarshal([]byte("d5:nodes0:e"), &mi)
+ c.Assert(err, qt.IsNil)
+}