From 8ebf56ea17f7f0f146c8046494fbc0697f259590 Mon Sep 17 00:00:00 2001 From: Peter Bieringer Date: Tue, 21 Apr 2026 18:57:13 +0200 Subject: [PATCH] sharing/csv: fix improper quote conversion --- radicale/sharing/csv.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/radicale/sharing/csv.py b/radicale/sharing/csv.py index 53caf6eb..5eb491cd 100644 --- a/radicale/sharing/csv.py +++ b/radicale/sharing/csv.py @@ -435,7 +435,14 @@ class Sharing(sharing.BaseSharing): if row[fieldname] is None or row[fieldname] == '': row[fieldname] = {} else: - field = row[fieldname].lstrip('"').rstrip('"').replace("'", '"') + field = row[fieldname].lstrip('"').rstrip('"') + logger.trace("json prep quote replacer match (before): %s", field) + field = field.replace('"', '\\"').replace("\\'", "'") # escape " + field = field.replace("{'", '{"') # replace for JSON start {' -> {" + field = field.replace("'}", '"}') # replace for JSON end '} -> "} + field = field.replace("': '", '": "') # replace for JSON entry/value ': ' -> ": " + field = field.replace("', '", '", "') # replace for JSON delimiter ', ' -> ", " + logger.trace("json prep quote replacer match (after) : %s", field) try: row[fieldname] = json.loads(field) except Exception as e: