fix(cas): remove .part before creating

This commit is contained in:
Mikaël Cluseau 2018-07-03 18:20:55 +11:00
parent 3b512e6105
commit a44d1cbe7f

View File

@ -45,8 +45,11 @@ func (s *DirStore) GetOrCreate(tag, item string, create func(io.Writer) error) (
return
}
partFile := fullPath + ".part"
os.Remove(partFile)
var out *os.File
out, err = os.OpenFile(fullPath+".part", os.O_CREATE|os.O_TRUNC|os.O_WRONLY|os.O_EXCL, 0600)
out, err = os.OpenFile(partFile, os.O_CREATE|os.O_TRUNC|os.O_WRONLY|os.O_EXCL, 0600)
if err != nil {
return
}