Check number of bytes saved for each file

This commit is contained in:
Alexander Neumann 2014-12-07 13:30:16 +01:00
parent a9077725ab
commit 3336f2b8e7
1 changed files with 7 additions and 0 deletions

View File

@ -241,10 +241,17 @@ func (arch *Archiver) SaveFile(node *Node) error {
}
}
var bytes uint64
node.Content = make([]backend.ID, len(blobs))
for i, blob := range blobs {
node.Content[i] = blob.ID
arch.bl.Insert(blob)
bytes += blob.Size
}
if bytes != node.Size {
return fmt.Errorf("errors saving node %q: saved %d bytes, wanted %d bytes", node.path, bytes, node.Size)
}
return nil