From 7639aea0aef14ce29d49e249a1af1da62733f609 Mon Sep 17 00:00:00 2001 From: cos Date: Tue, 25 May 2021 20:23:06 +0200 Subject: Fix: Specify calendar rather than random selection Without this commit, the calendar that gets used is undefined. With at least some CalDAV implementation this practically means one is randomly selected at every run. Having determinism at the small cost of required configuration is the user expected behaviour for anyone using an account with more than one calendar. --- calendar-cli.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/calendar-cli.py b/calendar-cli.py index ec9adaa..e9a36a5 100755 --- a/calendar-cli.py +++ b/calendar-cli.py @@ -148,6 +148,8 @@ def find_calendar(caldav_conn, args): calendars = caldav.Principal(caldav_conn).calendars() if not calendars: sys.stderr.write("no calendar url given and no default calendar found - can't proceed. You will need to create a calendar first") + if len(calendars) > 1: + sys.stderr.write("no calendar url given and several calendars found - refusing to select one at random. You will need to specify which one to use") return caldav.Principal(caldav_conn).calendars()[0] def _calendar_addics(caldav_conn, ics, uid, args): -- cgit v1.2.3