]> Sergey Matveev's repositories - btrtrc.git/commitdiff
torrent: Fix bug with common part not being cut off.
authornsf <no.smile.face@gmail.com>
Sun, 8 Jul 2012 21:37:16 +0000 (03:37 +0600)
committernsf <no.smile.face@gmail.com>
Sun, 8 Jul 2012 21:37:16 +0000 (03:37 +0600)
torrent/builder.go

index b3db7d41207f4042b9a58570874df93d010d1bd1..20103b60c0903433f1047372059ae553d25562d6 100644 (file)
@@ -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:]
                }