Merge pull request #165 from izolight/fix-single-files

Fix adding of single file torrents
This commit is contained in:
Bora M. Alper 2018-04-29 12:59:03 +01:00 committed by GitHub
commit 05126b7449
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -361,6 +361,14 @@ func (ms *MetadataSink) awaitMetadata(infoHash metainfo.Hash, peer Peer) {
} }
var files []persistence.File var files []persistence.File
// If there is only one file, there won't be a Files slice. That's why we need to add it here
if len(info.Files) == 0 {
files = append(files, persistence.File{
Size: info.Length,
Path: info.Name,
})
}
for _, file := range info.Files { for _, file := range info.Files {
if file.Length < 0 { if file.Length < 0 {
zap.L().Debug( zap.L().Debug(