fix(utils): Improve URL normalization by avoiding quote/unquote to preserve '+' signs. ref #1332
This commit is contained in:
@@ -2184,8 +2184,10 @@ def normalize_url(
|
|||||||
netloc = parsed.netloc.lower()
|
netloc = parsed.netloc.lower()
|
||||||
|
|
||||||
# ── path ──
|
# ── path ──
|
||||||
# Strip duplicate slashes and trailing “/” (except root)
|
# Strip duplicate slashes and trailing "/" (except root)
|
||||||
path = quote(unquote(parsed.path))
|
# IMPORTANT: Don't use quote(unquote()) as it mangles + signs in URLs
|
||||||
|
# The path from urlparse is already properly encoded
|
||||||
|
path = parsed.path
|
||||||
if path.endswith('/') and path != '/':
|
if path.endswith('/') and path != '/':
|
||||||
path = path.rstrip('/')
|
path = path.rstrip('/')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user