Skip to content
Myr

Fast path returns for normalize_path cases (#3189)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Tom Christie · committed by GitHub · parent 88a81c5 · Browse files · 1 file+10 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Co-authored-by: Kar Petrosyan <92274156+karpetrosyan@users.noreply.github.com>

Diff stats

1 file+10 added−1 removed

  • other:+10 added−1 removed

1 file+10 added−1 removed

modified:httpx/_urlparse.py+10 added-1 removed
390 unmodified lines
391 For example:392393 normalize_path("/path/./to/somewhere/..") == "/path/to"394 """395 # https://datatracker.ietf.org/doc/html/rfc3986#section-5.2.4395 # Fast return when no '.' characters in the path.396 if "." not in path:397 return path398399 components = path.split("/")400401 # Fast return when no '.' or '..' components in the path.402 if "." not in components and ".." not in components:403 return path404405 # https://datatracker.ietf.org/doc/html/rfc3986#section-5.2.4406 output: list[str] = []407 for component in components:408 if component == ".":409 pass
81 unmodified lines