diff --git a/radicale/__init__.py b/radicale/__init__.py index 79689af3..c8a0794c 100644 --- a/radicale/__init__.py +++ b/radicale/__init__.py @@ -175,14 +175,9 @@ class CalendarHTTPHandler(server.BaseHTTPRequestHandler): # ``self.path`` must be something like a posix path # ``normpath`` should clean malformed and malicious request paths attributes = posixpath.normpath(self.path.strip("/")).split("/") - if len(attributes) >= 2: - path = "%s/%s" % (attributes[0], attributes[1]) - elif len(attributes) == 1: # no owner - path = attributes[0] - else: - return - - return ical.Calendar(path) + if attributes: + path = "/".join(attributes[:min(len(attributes), 2)]) + return ical.Calendar(path) def _decode(self, text): """Try to decode text according to various parameters.""" diff --git a/radicale/acl/htpasswd.py b/radicale/acl/htpasswd.py index 2ddb9186..422b96c6 100644 --- a/radicale/acl/htpasswd.py +++ b/radicale/acl/htpasswd.py @@ -56,7 +56,8 @@ def _sha1(hash_value, password): def has_right(owner, user, password): """Check if ``user``/``password`` couple is valid.""" - if owner is None: # no owner - everybody is allowed + if owner is None and PERSONAL: + # No owner and personal calendars, everybody is allowed return True for line in open(FILENAME).readlines(): diff --git a/radicale/ical.py b/radicale/ical.py index 076d9bef..25a1b448 100644 --- a/radicale/ical.py +++ b/radicale/ical.py @@ -135,16 +135,9 @@ class Calendar(object): def __init__(self, path): """Initialize the calendar with ``cal`` and ``user`` parameters.""" - - split_path = path.split("/") - self.encoding = "utf-8" - - if len(split_path) > 1: - self.owner = split_path[0] - else: - self.owner = None - + split_path = path.split("/") + self.owner = split_path[0] if len(split_path) > 1 else None self.path = os.path.join(FOLDER, path.replace("/", os.path.sep)) @staticmethod