We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 88a81c5 commit 37593c1Copy full SHA for 37593c1
httpx/_urlparse.py
@@ -392,8 +392,17 @@ def normalize_path(path: str) -> str:
392
393
normalize_path("/path/./to/somewhere/..") == "/path/to"
394
"""
395
- # https://datatracker.ietf.org/doc/html/rfc3986#section-5.2.4
+ # Fast return when no '.' characters in the path.
396
+ if "." not in path:
397
+ return path
398
+
399
components = path.split("/")
400
401
+ # Fast return when no '.' or '..' components in the path.
402
+ if "." not in components and ".." not in components:
403
404
405
+ # https://datatracker.ietf.org/doc/html/rfc3986#section-5.2.4
406
output: list[str] = []
407
for component in components:
408
if component == ".":
0 commit comments