mirror of
https://github.com/go-vikunja/vikunja.git
synced 2026-02-01 22:47:40 +00:00
fix(caldav): do not assume the first element is the VTODO component
Cherry-Picked from https://github.com/go-vikunja/vikunja/pull/748#issuecomment-3649092134
This commit is contained in:
@@ -274,8 +274,14 @@ func ParseTaskFromVTODO(content string) (vTask *models.Task, err error) {
|
||||
if len(parsed.Components) == 0 {
|
||||
return nil, errors.New("VTODO element does seem not contain any components")
|
||||
}
|
||||
vTodo, ok := parsed.Components[0].(*ics.VTodo)
|
||||
if !ok {
|
||||
var vTodo *ics.VTodo
|
||||
for _, comp := range parsed.Components {
|
||||
if todo, ok := comp.(*ics.VTodo); ok {
|
||||
vTodo = todo
|
||||
break
|
||||
}
|
||||
}
|
||||
if vTodo == nil {
|
||||
return nil, errors.New("VTODO element not found")
|
||||
}
|
||||
// We put the vTodo details in a map to be able to handle them more easily
|
||||
|
||||
Reference in New Issue
Block a user