[CalendarServer-changes] [1434] CalendarServer/trunk/twistedcaldav/method/report_multiget.py

source_changes at macosforge.org source_changes at macosforge.org
Thu Mar 29 11:52:31 PDT 2007


Revision: 1434
          http://trac.macosforge.org/projects/calendarserver/changeset/1434
Author:   cdaboo at apple.com
Date:     2007-03-29 11:52:31 -0700 (Thu, 29 Mar 2007)

Log Message:
-----------
Proper fix for encoded characters in the URI. We need to only decode the last segment for getChild() since that expects a
decoded name. The remainder of thwe URI remains encoded as we need to do comparisons against the request.uri with that, and
request.uri is not encoded.

What we really need here is a proper URI class that can maintain its encoded/decoded state, so comparisons etc are done
transparently, and so we can avoid double-encode/decode issues too.

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/method/report_multiget.py

Modified: CalendarServer/trunk/twistedcaldav/method/report_multiget.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/report_multiget.py	2007-03-29 18:45:23 UTC (rev 1433)
+++ CalendarServer/trunk/twistedcaldav/method/report_multiget.py	2007-03-29 18:52:31 UTC (rev 1434)
@@ -123,12 +123,12 @@
     if not disabled:
         for href in resources:
 
-            resource_uri = unquote(str(href))
+            resource_uri = str(href)
 
             # Do href checks
             if requestURIis == "calendar":
                 # Verify that href is an immediate child of the request URI and that resource exists.
-                name = resource_uri[resource_uri.rfind("/") + 1:]
+                name = unquote(resource_uri[resource_uri.rfind("/") + 1:])
                 if not self._isChildURI(request, resource_uri) or self.getChild(name) is None:
                     responses.append(davxml.StatusResponse(href, davxml.Status.fromResponseCode(responsecode.NOT_FOUND)))
                     continue
@@ -143,7 +143,7 @@
                 child = child.getResult()
     
             elif requestURIis == "collection":
-                name = resource_uri[resource_uri.rfind("/") + 1:]
+                name = unquote(resource_uri[resource_uri.rfind("/") + 1:])
                 if not self._isChildURI(request, resource_uri, False):
                     responses.append(davxml.StatusResponse(href, davxml.Status.fromResponseCode(responsecode.NOT_FOUND)))
                     continue
@@ -184,7 +184,7 @@
                     filteredaces = filteredaces.getResult()
     
             else:
-                name = resource_uri[resource_uri.rfind("/") + 1:]
+                name = unquote(resource_uri[resource_uri.rfind("/") + 1:])
                 if (resource_uri != request.uri) or not self.exists():
                     responses.append(davxml.StatusResponse(href, davxml.Status.fromResponseCode(responsecode.NOT_FOUND)))
                     continue

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20070329/3be59fdf/attachment.html


More information about the calendarserver-changes mailing list