[CalendarServer-changes] [6303] CalendarServer/trunk/txdav/caldav/datastore/file.py

source_changes at macosforge.org source_changes at macosforge.org
Wed Sep 15 18:55:16 PDT 2010


Revision: 6303
          http://trac.macosforge.org/projects/calendarserver/changeset/6303
Author:   cdaboo at apple.com
Date:     2010-09-15 18:55:15 -0700 (Wed, 15 Sep 2010)
Log Message:
-----------
For backwards compatibility with old wiki data support auto conversion of \n to \r\n in data.

Modified Paths:
--------------
    CalendarServer/trunk/txdav/caldav/datastore/file.py

Modified: CalendarServer/trunk/txdav/caldav/datastore/file.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/file.py	2010-09-16 01:53:09 UTC (rev 6302)
+++ CalendarServer/trunk/txdav/caldav/datastore/file.py	2010-09-16 01:55:15 UTC (rev 6303)
@@ -302,10 +302,18 @@
             text.startswith("BEGIN:VCALENDAR\r\n") or
             text.endswith("\r\nEND:VCALENDAR\r\n")
         ):
-            raise InternalDataStoreError(
-                "File corruption detected (improper start) in file: %s"
-                % (self._path.path,)
-            )
+            # Handle case of old wiki data written using \n instead of \r\n
+            if False and (
+                text.startswith("BEGIN:VCALENDAR\n") and
+                text.endswith("\nEND:VCALENDAR\n")
+            ):
+                text = text.replace("\n", "\r\n")
+            else:
+                # Cannot deal with this data
+                raise InternalDataStoreError(
+                    "File corruption detected (improper start) in file: %s"
+                    % (self._path.path,)
+                )
         return text
 
     iCalendarText = text
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100915/a7aca962/attachment.html>


More information about the calendarserver-changes mailing list