Improve path collision check formatting

Refactor path collision check for readability.
This commit is contained in:
Peter Bieringer
2026-03-01 09:00:16 +01:00
committed by GitHub
parent 770cb31e7a
commit 0be7b620c9

View File

@@ -285,9 +285,8 @@ 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) and
not os.path.realpath(safe_path).endswith(part)):
raise CollidingPathError(part)
if (os.path.lexists(safe_path) and not os.path.realpath(safe_path).endswith(part)):
raise CollidingPathError(part)
return safe_path