[CalendarServer-changes] [6478] CalendarServer/trunk

source_changes at macosforge.org source_changes at macosforge.org
Wed Oct 27 18:49:31 PDT 2010


Revision: 6478
          http://trac.macosforge.org/projects/calendarserver/changeset/6478
Author:   cdaboo at apple.com
Date:     2010-10-27 18:49:29 -0700 (Wed, 27 Oct 2010)
Log Message:
-----------
Make sure direct shares use canonical __uids__ paths.

Modified Paths:
--------------
    CalendarServer/trunk/twext/web2/dav/resource.py
    CalendarServer/trunk/twistedcaldav/sharing.py
    CalendarServer/trunk/txdav/common/datastore/sql_legacy.py

Modified: CalendarServer/trunk/twext/web2/dav/resource.py
===================================================================
--- CalendarServer/trunk/twext/web2/dav/resource.py	2010-10-28 01:45:42 UTC (rev 6477)
+++ CalendarServer/trunk/twext/web2/dav/resource.py	2010-10-28 01:49:29 UTC (rev 6478)
@@ -725,14 +725,12 @@
         for childname in childnames:
             childpath = joinURL(basepath, urllib.quote(childname))
             child = (yield request.locateChildResource(self, childname))
-            if child.isCollection():
-                collections1.append((child, childpath + "/"))
-            if names and childname not in names1:
-                continue
-            if child is None:
-                children.append((None, childpath + "/"))
-            else:
+            if child is not None:
                 if child.isCollection():
+                    collections1.append((child, childpath + "/"))
+                if names and childname not in names1:
+                    continue
+                if child.isCollection():
                     children.append((child, childpath + "/"))
                 else:
                     children.append((child, childpath))

Modified: CalendarServer/trunk/twistedcaldav/sharing.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/sharing.py	2010-10-28 01:45:42 UTC (rev 6477)
+++ CalendarServer/trunk/twistedcaldav/sharing.py	2010-10-28 01:49:29 UTC (rev 6478)
@@ -196,7 +196,7 @@
             ))
 
         # Accept it
-        response = (yield home.acceptDirectShare(request, request.path, self.resourceID(), self.displayName()))
+        response = (yield home.acceptDirectShare(request, compareURL, self.resourceID(), self.displayName()))
 
         # Return the URL of the shared calendar
         returnValue(response)

Modified: CalendarServer/trunk/txdav/common/datastore/sql_legacy.py
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/sql_legacy.py	2010-10-28 01:45:42 UTC (rev 6477)
+++ CalendarServer/trunk/txdav/common/datastore/sql_legacy.py	2010-10-28 01:49:29 UTC (rev 6478)
@@ -520,6 +520,11 @@
     def addOrUpdateRecord(self, record):
         # record.hosturl -> /.../__uids__/<uid>/<name>
         splithost = record.hosturl.split('/')
+        
+        # Double-check the path
+        if splithost[2] != "__uids__":
+            raise ValueError("Sharing URL must be a __uids__ path: %s" % (record.hosturl,))
+            
         ownerUID = splithost[3]
         ownerCollectionName = splithost[4]
         ownerHome = yield self._getHomeWithUID(ownerUID)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20101027/e04427e2/attachment.html>


More information about the calendarserver-changes mailing list