summaryrefslogtreecommitdiff
path: root/pkgs/vdirsyncer-patch.nix
blob: 9265e216dad4bb2d37d7fb00a630c38ff7eaa98a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Patch vdirsyncer to skip NotFoundError on missing items instead of failing.
# This works around a Google CalDAV bug where recurring events with modified
# instances are listed but cannot be fetched.
# See: https://github.com/pimutils/vdirsyncer/issues/467
{ lib, vdirsyncer }:

vdirsyncer.overrideAttrs (oldAttrs: {
  patches = (oldAttrs.patches or []) ++ [
    (builtins.toFile "skip-notfound.patch" ''
--- a/vdirsyncer/storage/dav.py
+++ b/vdirsyncer/storage/dav.py
@@ -550,8 +550,11 @@ class DAVStorage(Storage):
                 else:
                     rv.append((href, Item(raw), etag))
             for href in hrefs_left:
-                raise exceptions.NotFoundError(href)
-
+                dav_logger.warning(
+                    f"Skipping {href!r}, server listed but did not return it. "
+                    "This is often caused by corrupted recurring events in Google Calendar."
+                )
+
             for href, item, etag in rv:
                 yield href, item, etag
 
'')
  ];
})