diff --git a/pkg/files/files.go b/pkg/files/files.go index b24a7b6d..1357434d 100644 --- a/pkg/files/files.go +++ b/pkg/files/files.go @@ -17,7 +17,9 @@ package files import ( + "code.vikunja.io/api/pkg/log" "io" + "os" "strconv" "time" @@ -129,9 +131,16 @@ func (f *File) Delete() (err error) { err = afs.Remove(f.getFileName()) if err != nil { + if e, is := err.(*os.PathError); is { + // Don't fail when removing the file failed + log.Errorf("Error deleting file %d: %s", e.Error()) + return s.Commit() + } + _ = s.Rollback() return err } + return } diff --git a/pkg/models/task_comments_test.go b/pkg/models/task_comments_test.go index ecc16ae0..ea272e27 100644 --- a/pkg/models/task_comments_test.go +++ b/pkg/models/task_comments_test.go @@ -195,7 +195,7 @@ func TestTaskComment_ReadAll(t *testing.T) { comments := result.([]*TaskComment) assert.NoError(t, err) assert.Len(t, comments, 2) - assert.Equal(t, int64(-2), comments[1].AuthorID) - assert.NotNil(t, comments[1].Author) + assert.Equal(t, int64(-2), comments[0].AuthorID) + assert.NotNil(t, comments[0].Author) }) }