aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@calcurse.org>2016-01-25 21:45:56 +0100
committerLukas Fleischer <lfleischer@calcurse.org>2016-01-25 21:55:10 +0100
commitbfafec3ebf07f12f01f4f940e7048ff0d9444e5b (patch)
tree02a3001077cbdfc262fef8380e4fbc8d227998c0
parent4fff8ae4fe2615c7d966c4b2f73b2a4dbf9c6abf (diff)
downloadcalcurse-bfafec3ebf07f12f01f4f940e7048ff0d9444e5b.tar.gz
calcurse-bfafec3ebf07f12f01f4f940e7048ff0d9444e5b.zip
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 <lfleischer@calcurse.org>
-rwxr-xr-xcontrib/caldav/calcurse-caldav.py5
1 files changed, 4 insertions, 1 deletions
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: