Skip to content

utils.py: Fix _ensure_real_directory() - #2200

Open
juergbi wants to merge 1 commit into
masterfrom
jbilleter/ensure_real_directory
Open

juergbi wants to merge 1 commit into
masterfrom
jbilleter/ensure_real_directory

Conversation

@juergbi

@juergbi juergbi commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

os.path.split() splits the path into a (head, tail) pair, not into a list of all path segments.

Use pathlib to iterate over all path segments and also reject absolute paths.

_ensure_real_directory() is only called from _process_list(), though, where it's separately called for each level in the hierarchy. Due to this, each path segment was already checked and thus, the previous bug didn't cause any issues.

`os.path.split()` splits the path into a `(head, tail)` pair, not into a
list of all path segments.

Use `pathlib` to iterate over all path segments and also reject absolute
paths.

`_ensure_real_directory()` is only called from `_process_list()`,
though, where it's separately called for each level in the hierarchy.
Due to this, each path segment was already checked and thus, the
previous bug didn't cause any issues.
@juergbi
juergbi force-pushed the jbilleter/ensure_real_directory branch from 390a570 to b117ed8 Compare October 16, 2026 14:48

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant