From: nsf Date: Sun, 8 Jul 2012 21:37:16 +0000 (+0600) Subject: torrent: Fix bug with common part not being cut off. X-Git-Tag: v1.0.0~1199^2~16 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=f954b649c6ee805d56f135c7ba38ebe97288c7bb;p=btrtrc.git torrent: Fix bug with common part not being cut off. --- diff --git a/torrent/builder.go b/torrent/builder.go index b3db7d41..20103b60 100644 --- a/torrent/builder.go +++ b/torrent/builder.go @@ -127,7 +127,6 @@ func (b *Builder) Submit() (*Batch, error) { file.splitpath = split_path(f) file.size = fi.Size() batch.files = append(batch.files, file) - batch.TotalSize += file.size } @@ -163,7 +162,8 @@ func (b *Builder) Submit() (*Batch, error) { batch.DefaultName = common[len(common)-1] lcommon := len(common) - for _, f := range batch.files { + for i := range batch.files { + f := &batch.files[i] f.splitpath = f.splitpath[lcommon:] }