Merge pull request #466 from Unrud/fixpath
Set correct path for child collections
This commit is contained in:
commit
9f2cbb81a3
@ -497,8 +497,9 @@ class Collection(BaseCollection):
|
|||||||
continue
|
continue
|
||||||
child_filesystem_path = path_to_filesystem(filesystem_path, href)
|
child_filesystem_path = path_to_filesystem(filesystem_path, href)
|
||||||
if os.path.isdir(child_filesystem_path):
|
if os.path.isdir(child_filesystem_path):
|
||||||
|
child_path = posixpath.join(path, href)
|
||||||
child_principal = len(attributes) == 0
|
child_principal = len(attributes) == 0
|
||||||
yield cls(child_filesystem_path, child_principal)
|
yield cls(child_path, child_principal)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def create_collection(cls, href, collection=None, props=None):
|
def create_collection(cls, href, collection=None, props=None):
|
||||||
|
@ -20,6 +20,7 @@ Radicale tests with simple requests.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
import posixpath
|
||||||
import shutil
|
import shutil
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
@ -188,6 +189,21 @@ class BaseRequests:
|
|||||||
status, headers, answer = self.request("GET", "/event1.ics")
|
status, headers, answer = self.request("GET", "/event1.ics")
|
||||||
assert status == 404
|
assert status == 404
|
||||||
|
|
||||||
|
def test_propfind(self):
|
||||||
|
calendar_path = "/calendar.ics/"
|
||||||
|
self.request("MKCALENDAR", calendar_path)
|
||||||
|
event = get_file_content("event1.ics")
|
||||||
|
event_path = posixpath.join(calendar_path, "event.ics")
|
||||||
|
self.request("PUT", event_path, event)
|
||||||
|
status, headers, answer = self.request("PROPFIND", "/", HTTP_DEPTH="1")
|
||||||
|
assert status == 207
|
||||||
|
assert "href>/</" in answer
|
||||||
|
assert "href>%s</" % calendar_path in answer
|
||||||
|
status, headers, answer = self.request("PROPFIND", calendar_path, HTTP_DEPTH="1")
|
||||||
|
assert status == 207
|
||||||
|
assert "href>%s</" % calendar_path in answer
|
||||||
|
assert "href>%s</" % event_path in answer
|
||||||
|
|
||||||
def test_multiple_events_with_same_uid(self):
|
def test_multiple_events_with_same_uid(self):
|
||||||
"""Add two events with the same UID."""
|
"""Add two events with the same UID."""
|
||||||
self.request("MKCOL", "/calendar.ics/")
|
self.request("MKCOL", "/calendar.ics/")
|
||||||
|
@ -541,7 +541,8 @@ def _propfind_response(path, item, props, user, write=False):
|
|||||||
|
|
||||||
href = ET.Element(_tag("D", "href"))
|
href = ET.Element(_tag("D", "href"))
|
||||||
if is_collection:
|
if is_collection:
|
||||||
uri = item.path
|
# Some clients expect collections to end with /
|
||||||
|
uri = item.path + "/"
|
||||||
else:
|
else:
|
||||||
# TODO: fix this
|
# TODO: fix this
|
||||||
if path.split("/")[-1] == item.href:
|
if path.split("/")[-1] == item.href:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user