Browse Source

delete old entry only after successful insert

pull/667/head
Chris Lu 7 years ago
parent
commit
db0c25b3d8
  1. 6
      weed/filer2/filer.go

6
weed/filer2/filer.go

@ -104,14 +104,14 @@ func (f *Filer) CreateEntry(entry *Entry) error {
}
*/
if oldEntry, err := f.FindEntry(entry.FullPath); err == nil {
f.deleteChunks(oldEntry)
}
oldEntry, _ := f.FindEntry(entry.FullPath)
if err := f.store.InsertEntry(entry); err != nil {
return fmt.Errorf("insert entry %s: %v", entry.FullPath, err)
}
f.deleteChunks(oldEntry)
return nil
}

Loading…
Cancel
Save