From 57cf68258331c63759fc5fa35047219a71904f99 Mon Sep 17 00:00:00 2001 From: tpearson Date: Thu, 23 Sep 2010 05:34:56 +0000 Subject: Fixed corner case in libcarddav; error occured while saving when UID was broken across multiple lines and/or included whitespace git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1178442 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kresources/caldav/resource.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'kresources/caldav') diff --git a/kresources/caldav/resource.cpp b/kresources/caldav/resource.cpp index 003633a40..f6ad54752 100644 --- a/kresources/caldav/resource.cpp +++ b/kresources/caldav/resource.cpp @@ -739,6 +739,15 @@ TQString ResourceCalDav::getICalString(const Incidence::List& inc) { } data = data + footer; + // Remove any line feeds/carriage returns/white spaces from the UID field as they WILL break libcaldav + int uidPos = data.find("UID:", 0) + 4; + int nextPos = data.findRev("\n", data.find(":", uidPos)); + TQString uidField = data.mid(uidPos, nextPos-uidPos); + data.remove(uidPos, nextPos-uidPos); + uidField.replace("\n", ""); + uidField.replace("\r", ""); + uidField.replace(" ", ""); + data.insert(uidPos, uidField); return data; } -- cgit v1.2.1