fix(caldav): don't try to parse a list url as task when it does not end in .ics
This commit is contained in:
parent
57084b40c3
commit
b71c74867e
|
@ -130,12 +130,20 @@ func (vcls *VikunjaCaldavListStorage) GetResourcesByList(rpaths []string) ([]dat
|
||||||
// So we split the url in parts, take the last one and strip the ".ics" at the end
|
// So we split the url in parts, take the last one and strip the ".ics" at the end
|
||||||
var uids []string
|
var uids []string
|
||||||
for _, path := range rpaths {
|
for _, path := range rpaths {
|
||||||
|
if !strings.HasSuffix(path, ".ics") {
|
||||||
|
// Looks like this is not a task url
|
||||||
|
continue
|
||||||
|
}
|
||||||
parts := strings.Split(path, "/")
|
parts := strings.Split(path, "/")
|
||||||
uid := []rune(parts[4]) // The 4th part is the id with ".ics" suffix
|
uid := []rune(parts[4]) // The 4th part is the id with ".ics" suffix
|
||||||
endlen := len(uid) - len(".ics") // ".ics" are 4 bytes
|
endlen := len(uid) - len(".ics") // ".ics" are 4 bytes
|
||||||
uids = append(uids, string(uid[:endlen]))
|
uids = append(uids, string(uid[:endlen]))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(uids) == 0 {
|
||||||
|
return []data.Resource{}, nil
|
||||||
|
}
|
||||||
|
|
||||||
s := db.NewSession()
|
s := db.NewSession()
|
||||||
defer s.Close()
|
defer s.Close()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue