forked from vikunja/vikunja
fix(task): correctly load tasks by id and uuid in caldav
Partially reverts 1afc72e190
This commit is contained in:
parent
e8c85562b1
commit
534d04a1db
|
@ -1612,7 +1612,7 @@ func (t *Task) Delete(s *xorm.Session, a web.Auth) (err error) {
|
|||
// @Router /tasks/{ID} [get]
|
||||
func (t *Task) ReadOne(s *xorm.Session, a web.Auth) (err error) {
|
||||
|
||||
*t, err = GetTaskSimple(s, t)
|
||||
*t, err = GetTaskByIDSimple(s, t.ID)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
|
|
@ -210,7 +210,7 @@ func (vcls *VikunjaCaldavListStorage) GetResource(rpath string) (*data.Resource,
|
|||
|
||||
// save and override the updated unix date to not break any later etag checks
|
||||
updated := vcls.task.Updated
|
||||
err := vcls.task.ReadOne(s, vcls.user)
|
||||
tasks, err := models.GetTasksByUIDs(s, []string{vcls.task.UID}, vcls.user)
|
||||
if err != nil {
|
||||
_ = s.Rollback()
|
||||
if models.IsErrTaskDoesNotExist(err) {
|
||||
|
@ -222,6 +222,11 @@ func (vcls *VikunjaCaldavListStorage) GetResource(rpath string) (*data.Resource,
|
|||
return nil, false, err
|
||||
}
|
||||
|
||||
if len(tasks) < 1 {
|
||||
return nil, false, errs.ResourceNotFoundError
|
||||
}
|
||||
vcls.task = tasks[0]
|
||||
|
||||
if updated.Unix() > 0 {
|
||||
vcls.task.Updated = updated
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user