We should remove file only when checksums are calculated

This commit is contained in:
Andrey Smirnov
2017-04-20 00:45:23 +03:00
parent 5dd11a2ec2
commit 8078f3b588

View File

@@ -336,10 +336,6 @@ func (pool *PackagePool) Import(srcPath, basename string, checksums *utils.Check
}
}
if err == nil && move {
err = os.Remove(srcPath)
}
if err == nil {
if !checksums.Complete() {
// need full checksums here
@@ -352,6 +348,10 @@ func (pool *PackagePool) Import(srcPath, basename string, checksums *utils.Check
err = checksumStorage.Update(poolPath, checksums)
}
if err == nil && move {
err = os.Remove(srcPath)
}
return poolPath, err
}