From bfafec3ebf07f12f01f4f940e7048ff0d9444e5b Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Mon, 25 Jan 2016 21:45:56 +0100 Subject: calcurse-caldav: Handle missing ETag gracefully This was partly fixed by 475c341 (calcurse-caldav: Fix late retrieval of ETag, 2016-01-25). However, the case where the server does not return ETag after creating a new item still wasn't handled properly. This patch hopefully addresses this and also makes sure that the ETag header is matched case-insensitively. Signed-off-by: Lukas Fleischer --- contrib/caldav/calcurse-caldav.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/contrib/caldav/calcurse-caldav.py b/contrib/caldav/calcurse-caldav.py index e02a905..3bea80b 100755 --- a/contrib/caldav/calcurse-caldav.py +++ b/contrib/caldav/calcurse-caldav.py @@ -192,7 +192,10 @@ def push_object(conn, objhash): if not headers: return None - etag = [header[1] for header in headers if header[0] == 'ETag'][0] + etag = None + headerdict = dict((key.lower(), value) for key, value in headers) + if 'etag' in headerdict: + etag = headerdict['etag'] while not etag: hrefmap = get_hrefmap(conn, objhash) if len(hrefmap.keys()) > 0: -- cgit v1.2.3-70-g09d2