mirror of
https://github.com/Kozea/Radicale.git
synced 2025-07-23 17:48:30 +00:00
Detect when item path is a directory on Windows
This commit is contained in:
parent
cc89fc6f79
commit
bf272a99db
1 changed files with 6 additions and 0 deletions
|
@ -1363,6 +1363,12 @@ class Collection(BaseCollection):
|
||||||
raw_text = f.read()
|
raw_text = f.read()
|
||||||
except (FileNotFoundError, IsADirectoryError):
|
except (FileNotFoundError, IsADirectoryError):
|
||||||
return None, None
|
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,
|
# The hash of the component in the file system. This is used to check,
|
||||||
# if the entry in the cache is still valid.
|
# if the entry in the cache is still valid.
|
||||||
input_hash = self._item_cache_hash(raw_text)
|
input_hash = self._item_cache_hash(raw_text)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue