mirror of
https://github.com/django/django.git
synced 2025-10-26 07:06:08 +00:00
Fixed #22223 -- Prevented over-escaping URLs in reverse()
And follow more closely the class of characters defined in the RFC 3986. Thanks Erik van Zijst for the report and the initial patch, and Tim Graham for the review.
This commit is contained in:
@@ -7,6 +7,7 @@ import sys
|
||||
|
||||
from django.utils.encoding import force_text, force_str
|
||||
from django.utils.functional import allow_lazy
|
||||
from django.utils.http import RFC3986_GENDELIMS, RFC3986_SUBDELIMS
|
||||
from django.utils.safestring import SafeData, mark_safe
|
||||
from django.utils import six
|
||||
from django.utils.six.moves.urllib.parse import quote, unquote, urlsplit, urlunsplit
|
||||
@@ -215,7 +216,7 @@ def smart_urlquote(url):
|
||||
|
||||
url = unquote(force_str(url))
|
||||
# See http://bugs.python.org/issue2637
|
||||
url = quote(url, safe=b'!*\'();:@&=+$,/?#[]~')
|
||||
url = quote(url, safe=RFC3986_SUBDELIMS + RFC3986_GENDELIMS + str('~'))
|
||||
|
||||
return force_text(url)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user