Skip to content

replace lstrip with removeprefix in WSGI path lookup#313

Open
GibberishIT wants to merge 1 commit intogrindsa:masterfrom
GibberishIT:fix-lstrip-wsgi-path
Open

replace lstrip with removeprefix in WSGI path lookup#313
GibberishIT wants to merge 1 commit intogrindsa:masterfrom
GibberishIT:fix-lstrip-wsgi-path

Conversation

@GibberishIT
Copy link
Copy Markdown

When starting a WSGI Server with the Directory:url_prefix configured: If the url_prefix contains characters from the requested path, too much is stripped from the path and some URLs become unreachable.

https://docs.python.org/3/library/stdtypes.html#str.lstrip

"The chars argument is not a prefix; rather, all combinations of its values are stripped."

removeprefix is python 3.9+ but should be safer. For check:

"/directory".lstrip("/devel-base")

When starting a WSGI Server with the Directory:url_prefix configured: If the url_prefix contains characters from the requested path, too much is stripped from the path and some URLs become unreachable.

https://docs.python.org/3/library/stdtypes.html#str.lstrip

"The chars argument is not a prefix; rather, all combinations of its values are stripped."

removeprefix is python 3.9+ but should be safer. For check:

"/directory".lstrip("/devel-base")
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