fix(utils): Improve URL normalization by avoiding quote/unquote to preserve '+' signs. ref #1332

This commit is contained in:
ntohidi
2025-08-22 12:05:21 +08:00
parent 90af453506
commit 40ab287c90

View File

@@ -2184,8 +2184,10 @@ def normalize_url(
netloc = parsed.netloc.lower()
# ── path ──
# Strip duplicate slashes and trailing “/” (except root)
path = quote(unquote(parsed.path))
# Strip duplicate slashes and trailing "/" (except root)
# 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 != '/':
path = path.rstrip('/')