Torrent.Metainfo: Don't return incomplete metadata bytes

Fixes #208
This commit is contained in:
Matt Joiner 2017-11-08 19:56:20 +11:00
parent f960ec1b65
commit 163a63f9a7
1 changed files with 7 additions and 1 deletions

View File

@ -548,7 +548,13 @@ func (t *Torrent) newMetaInfo() metainfo.MetaInfo {
Comment: "dynamic metainfo from client",
CreatedBy: "go.torrent",
AnnounceList: t.metainfo.UpvertedAnnounceList(),
InfoBytes: t.metadataBytes,
InfoBytes: func() []byte {
if t.haveInfo() {
return t.metadataBytes
} else {
return nil
}
}(),
}
}