From 9ebb143c447aa17a12a61e865c6c89382bea7543 Mon Sep 17 00:00:00 2001 From: Guillaume Ayoub Date: Fri, 3 Feb 2012 15:58:08 +0100 Subject: [PATCH] Work around a bug in Evolution (fixes #664) --- radicale/__init__.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/radicale/__init__.py b/radicale/__init__.py index 3b27ce4..aa3e9e2 100644 --- a/radicale/__init__.py +++ b/radicale/__init__.py @@ -277,7 +277,9 @@ class Application(object): item = collection.get_item( xmlutils.name_from_path(environ["PATH_INFO"], collection)) - if item and environ.get("HTTP_IF_MATCH", item.etag) == item.etag: + # Evolution bug workaround + etag = environ.get("HTTP_IF_MATCH", item.etag).replace("\\", "") + if item and etag == item.etag: # No ETag precondition or precondition verified, delete item answer = xmlutils.delete(environ["PATH_INFO"], collection) status = client.NO_CONTENT @@ -410,8 +412,11 @@ class Application(object): headers = {} item_name = xmlutils.name_from_path(environ["PATH_INFO"], collection) item = collection.get_item(item_name) - if (not item and not environ.get("HTTP_IF_MATCH")) or ( - item and environ.get("HTTP_IF_MATCH", item.etag) == item.etag): + + # Evolution bug workaround + etag = environ.get("HTTP_IF_MATCH", "").replace("\\", "") + if (not item and not etag) or ( + item and ((etag or item.etag) == item.etag)): # PUT allowed in 3 cases # Case 1: No item and no ETag precondition: Add new item # Case 2: Item and ETag precondition verified: Modify item