init commit
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
# Follow Django in treating URLs as UTF-8 encoded (which requires undoing the
|
||||
# implicit ISO-8859-1 decoding applied in Python 3). Strictly speaking, URLs
|
||||
# should only be ASCII anyway, but UTF-8 can be found in the wild.
|
||||
def decode_path_info(path_info):
|
||||
return path_info.encode("iso-8859-1", "replace").decode("utf-8", "replace")
|
||||
|
||||
|
||||
def ensure_leading_trailing_slash(path):
|
||||
path = (path or "").strip("/")
|
||||
return f"/{path}/" if path else "/"
|
||||
Reference in New Issue
Block a user