Ticket #19825: URLValidator.patch

File URLValidator.patch, 1.2 KB (added by agestart@…, 11 years ago)

patch

Line 
1*** core/validators.py 2012-11-21 12:55:55.675173918 +0400
2--- core/validators.py 2012-11-21 15:31:57.895171400 +0400
3***************
4*** 50,56 ****
5 r'localhost|' #localhost...
6 r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})' # ...or ip
7 r'(?::\d+)?' # optional port
8! r'(?:/?|[/?]\S+)$', re.IGNORECASE)
9
10 def __init__(self, verify_exists=False,
11 validator_user_agent=URL_VALIDATOR_USER_AGENT):
12--- 50,56 ----
13 r'localhost|' #localhost...
14 r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})' # ...or ip
15 r'(?::\d+)?' # optional port
16! r'(?:/?|[/?].+)$', re.IGNORECASE)
17
18 def __init__(self, verify_exists=False,
19 validator_user_agent=URL_VALIDATOR_USER_AGENT):
20***************
21*** 94,99 ****
22--- 94,100 ----
23 }
24 url = url.encode('utf-8')
25 # Quote characters from the unreserved set, refs #16812
26+ url = '%' in url and urllib.unquote(url) or url
27 url = urllib.quote(url, "!*'();:@&=+$,/?#[]")
28 broken_error = ValidationError(
29 _(u'This URL appears to be a broken link.'), code='invalid_link')
Back to Top