From b71c74867e53270f760a632bf23d72f5f353aa47 Mon Sep 17 00:00:00 2001 From: kolaente Date: Tue, 14 Feb 2023 12:00:22 +0100 Subject: [PATCH] fix(caldav): don't try to parse a list url as task when it does not end in .ics --- pkg/routes/caldav/listStorageProvider.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkg/routes/caldav/listStorageProvider.go b/pkg/routes/caldav/listStorageProvider.go index 0d1692c18..096304dcf 100644 --- a/pkg/routes/caldav/listStorageProvider.go +++ b/pkg/routes/caldav/listStorageProvider.go @@ -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 var uids []string for _, path := range rpaths { + if !strings.HasSuffix(path, ".ics") { + // Looks like this is not a task url + continue + } parts := strings.Split(path, "/") uid := []rune(parts[4]) // The 4th part is the id with ".ics" suffix endlen := len(uid) - len(".ics") // ".ics" are 4 bytes uids = append(uids, string(uid[:endlen])) } + if len(uids) == 0 { + return []data.Resource{}, nil + } + s := db.NewSession() defer s.Close()