File tree Expand file tree Collapse file tree 1 file changed +2
-5
lines changed
Expand file tree Collapse file tree 1 file changed +2
-5
lines changed Original file line number Diff line number Diff line change @@ -282,14 +282,11 @@ def path_to_filesystem(root: str, sane_path: str) -> str:
282282 for part in parts :
283283 if not is_safe_filesystem_path_component (part ):
284284 raise UnsafePathError (part )
285- safe_path_parent = safe_path
286285 safe_path = os .path .join (safe_path , part )
287286 # Check for conflicting files (e.g. case-insensitive file systems
288287 # or short names on Windows file systems)
289- if os .path .lexists (safe_path ):
290- with os .scandir (safe_path_parent ) as entries :
291- if part not in (e .name for e in entries ):
292- raise CollidingPathError (part )
288+ if (os .path .lexists (safe_path ) and not os .path .realpath (safe_path ).endswith (part )):
289+ raise CollidingPathError (part )
293290 return safe_path
294291
295292
You can’t perform that action at this time.
0 commit comments