diff --git a/radicale/__init__.py b/radicale/__init__.py index 9331821..90b0752 100644 --- a/radicale/__init__.py +++ b/radicale/__init__.py @@ -321,9 +321,9 @@ class Application: content = None if is_valid_user: - if function in (self.do_GET, self.do_HEAD, - self.do_OPTIONS, self.do_PROPFIND, - self.do_REPORT): + if function in ( + self.do_GET, self.do_HEAD, self.do_OPTIONS, + self.do_PROPFIND, self.do_REPORT): lock_mode = "r" else: lock_mode = "w" diff --git a/radicale/storage.py b/radicale/storage.py index 446d7bb..30859cf 100644 --- a/radicale/storage.py +++ b/radicale/storage.py @@ -385,8 +385,7 @@ class Collection(BaseCollection): _, directories, _ = next(os.walk(collection._filesystem_path)) for sub_path in directories: if not is_safe_filesystem_path_component(sub_path): - cls.logger.debug( - "Skipping collection: %s", sub_path) + cls.logger.debug("Skipping collection: %s", sub_path) continue full_path = os.path.join(collection._filesystem_path, sub_path) if os.path.exists(full_path): @@ -441,8 +440,7 @@ class Collection(BaseCollection): for href in hrefs: if not is_safe_filesystem_path_component(href): - self.logger.debug( - "Skipping component: %s", href) + self.logger.debug("Skipping component: %s", href) continue path = os.path.join(self._filesystem_path, href) if not href.endswith(".props") and os.path.isfile(path): @@ -560,6 +558,9 @@ class Collection(BaseCollection): return None items = [] for href in os.listdir(self._filesystem_path): + if not is_safe_filesystem_path_component(href): + self.logger.debug("Skipping component: %s", href) + continue path = os.path.join(self._filesystem_path, href) if os.path.isfile(path) and not path.endswith(".props"): with open(path, encoding=self.storage_encoding) as fd: diff --git a/radicale/xmlutils.py b/radicale/xmlutils.py index b57f08d..bf3fff9 100644 --- a/radicale/xmlutils.py +++ b/radicale/xmlutils.py @@ -505,8 +505,7 @@ def delete(path, collection): return _pretty_xml(multistatus) -def propfind(path, xml_request, read_collections, write_collections, - user=None): +def propfind(path, xml_request, read_collections, write_collections, user): """Read and answer PROPFIND requests. Read rfc4918-9.1 for info. @@ -552,7 +551,7 @@ def _propfind_response(path, item, props, user, write=False): # TODO: fix this is_collection = hasattr(item, "list") if is_collection: - is_leaf = bool(item.list()) + is_leaf = bool(item.get_meta("tag")) collection = item else: collection = item.collection @@ -671,16 +670,7 @@ def _propfind_response(path, item, props, user, write=False): elif tag == _tag("CS", "getctag"): element.text = item.etag elif tag == _tag("C", "calendar-timezone"): - timezones = set() - for href, _ in item.list(): - event = item.get(href) - if "vtimezone" in event.contents: - for timezone_ in event.vtimezone_list: - timezones.add(timezone_) - timezone_collection = vobject.iCalendar() - for timezone_ in timezones: - timezone_collection.add(timezone_) - element.text = timezone_collection.serialize() + element.text = item.get_meta("C:calendar-timezone") elif tag == _tag("D", "displayname"): element.text = item.get_meta("D:displayname") or item.path elif tag == _tag("ICAL", "calendar-color"):