diff options
author | Tobias Brox <tobias@redpill-linpro.com> | 2018-03-27 11:09:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-27 11:09:00 +0200 |
commit | 067aaaaf0fe5e732f42c56714a4e9e83349d5364 (patch) | |
tree | 18e18db5b51599891e99d578290d98ba1ce2a3d6 | |
parent | 5d533b1da2ec7095106b76219b59eda0a686175c (diff) | |
parent | e14aa5ff6066bdb2d547a328a65cb301ba699f74 (diff) | |
download | calendar-cli-067aaaaf0fe5e732f42c56714a4e9e83349d5364.zip |
Merge pull request #42 from ymitsos/master
Ommit METHOD property if included in request
-rwxr-xr-x | calendar-cli.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/calendar-cli.py b/calendar-cli.py index ec5784f..d3c444f 100755 --- a/calendar-cli.py +++ b/calendar-cli.py @@ -1,4 +1,4 @@ -#!/usr/bin/python2 +#!/usr/bin/env python2 """ calendar-cli.py - high-level cli against caldav servers @@ -140,6 +140,9 @@ def _calendar_addics(caldav_conn, ics, uid, args): return c = find_calendar(caldav_conn, args) + if re.search(r'^METHOD:[A-Z]+[\r\n]+',ics,flags=re.MULTILINE) and args.ignoremethod: + ics = re.sub(r'^METHOD:[A-Z]+[\r\n]+', '', ics, flags=re.MULTILINE) + print ("METHOD property found and ignored") c.add_event(ics) def calendar_addics(caldav_conn, args): @@ -749,6 +752,7 @@ def main(): parser.add_argument("--ssl-verify-cert", help="verification of the SSL cert - 'yes' to use the OS-provided CA-bundle, 'no' to trust any cert and the path to a CA-bundle") parser.add_argument("--debug-logging", help="turn on debug logging", action="store_true") parser.add_argument("--calendar-url", help="URL for calendar to be used (may be absolute or relative to caldav URL, or just the name of the calendar)") + parser.add_argument("--ignoremethod", help="Ignores METHOD property if exists in the request. This violates RFC4791 but is sometimes appended by some calendar servers", action="store_true") ## TODO: check sys.argv[0] to find command ## TODO: set up logging |