Skip to content

Fix absolute path detection with empty path components.#28

Open
will-ca wants to merge 1 commit intoelan-ev:mainfrom
will-ca:patch-2
Open

Fix absolute path detection with empty path components.#28
will-ca wants to merge 1 commit intoelan-ev:mainfrom
will-ca:patch-2

Conversation

@will-ca
Copy link
Copy Markdown

@will-ca will-ca commented Mar 1, 2023

Fixes #27.

Untested. But should be simple enough.

https://docs.python.org/3/library/os.path.html#os.path.abspath https://docs.python.org/3/library/os.path.html#os.path.normpath

Note Python docs explicitly specify that abspath() usually includes a transform that is equivalent to normpath.

Perhaps also note comment in Python docs that this "may change the meaning of a path that contains symbolic links".

…Actually, why is it .startswith() instead of ==, or even just .startswith('/')— or path.isabs()— anyway?

Fixes elan-ev#27.

Untested. But should be simple enough.

https://docs.python.org/3/library/os.path.html#os.path.abspath
https://docs.python.org/3/library/os.path.html#os.path.normpath

Note Python docs explicitly specify that `abspath()` usually includes a transform that is equivalent to `normpath`.

Perhaps also note comment in Python docs that this "may change the meaning of a path that contains symbolic links".

…Actually, why is it `.startswith()` instead of `==`, or even just `.startswith('/')`— or `path.isabs()`— anyway?
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.

Absolute path check will fail if the input path includes double slashes (empty components, '//'), which can happen in scripts.

1 participant