From bf272a99dba615dfc858b12b27a8c36faf17ba82 Mon Sep 17 00:00:00 2001 From: Unrud Date: Wed, 6 Dec 2017 21:46:22 +0100 Subject: [PATCH] Detect when item path is a directory on Windows --- radicale/storage.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/radicale/storage.py b/radicale/storage.py index 04e87f59..6d949872 100644 --- a/radicale/storage.py +++ b/radicale/storage.py @@ -1363,6 +1363,12 @@ class Collection(BaseCollection): raw_text = f.read() except (FileNotFoundError, IsADirectoryError): return None, None + except PermissionError: + # Windows raises ``PermissionError`` when ``path`` is a directory + if (os.name == "nt" and + os.path.isdir(path) and os.access(path, os.R_OK)): + return None, None + raise # The hash of the component in the file system. This is used to check, # if the entry in the cache is still valid. input_hash = self._item_cache_hash(raw_text)