skip deletion if entry not found

This commit is contained in:
Chris Lu 2018-05-27 00:00:56 -07:00
parent f124ebab1d
commit 603de2d5db
2 changed files with 8 additions and 2 deletions

View file

@ -79,7 +79,10 @@ func (store *AbstractSqlStore) FindEntry(fullpath filer2.FullPath) (*filer2.Entr
func (store *AbstractSqlStore) DeleteEntry(fullpath filer2.FullPath) (*filer2.Entry, error) { func (store *AbstractSqlStore) DeleteEntry(fullpath filer2.FullPath) (*filer2.Entry, error) {
entry, _ := store.FindEntry(fullpath) entry, err := store.FindEntry(fullpath)
if err != nil {
return nil, nil
}
dir, name := fullpath.DirAndName() dir, name := fullpath.DirAndName()

View file

@ -96,7 +96,10 @@ func (store *LevelDBStore) FindEntry(fullpath filer2.FullPath) (entry *filer2.En
func (store *LevelDBStore) DeleteEntry(fullpath filer2.FullPath) (entry *filer2.Entry, err error) { func (store *LevelDBStore) DeleteEntry(fullpath filer2.FullPath) (entry *filer2.Entry, err error) {
key := genKey(fullpath.DirAndName()) key := genKey(fullpath.DirAndName())
entry, _ = store.FindEntry(fullpath) entry, err = store.FindEntry(fullpath)
if err != nil {
return nil, nil
}
err = store.db.Delete(key, nil) err = store.db.Delete(key, nil)
if err != nil { if err != nil {