From d3018a4c06fe1ac4de5a135f61054113359f65e3 Mon Sep 17 00:00:00 2001 From: Francois Lesueur Date: Fri, 27 Feb 2026 15:04:00 +0100 Subject: [PATCH] improve path_to_filesystem() performance --- radicale/pathutils.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/radicale/pathutils.py b/radicale/pathutils.py index 488dbfc0..1be03232 100644 --- a/radicale/pathutils.py +++ b/radicale/pathutils.py @@ -286,10 +286,9 @@ def path_to_filesystem(root: str, sane_path: str) -> str: safe_path = os.path.join(safe_path, part) # Check for conflicting files (e.g. case-insensitive file systems # or short names on Windows file systems) - if os.path.lexists(safe_path): - with os.scandir(safe_path_parent) as entries: - if part not in (e.name for e in entries): - raise CollidingPathError(part) + if (os.path.lexists(safe_path) and + not os.path.realpath(safe_path).endswith(part)): + raise CollidingPathError(part) return safe_path