mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Added safety to URL decoding in is_safe_url() on Python 2
The errors='replace' parameter to force_text altered the URL before checking it, which wasn't considered sane. Refs24fc935218andada7a4aef.
This commit is contained in:
@@ -124,7 +124,7 @@ class TestUtilsHttp(unittest.TestCase):
|
||||
)
|
||||
self.assertFalse(http.is_safe_url(b'\x08//example.com', host='testserver'))
|
||||
self.assertTrue(http.is_safe_url('àview/'.encode('utf-8'), host='testserver'))
|
||||
self.assertTrue(http.is_safe_url('àview'.encode('latin-1'), host='testserver'))
|
||||
self.assertFalse(http.is_safe_url('àview'.encode('latin-1'), host='testserver'))
|
||||
|
||||
# Valid basic auth credentials are allowed.
|
||||
self.assertTrue(http.is_safe_url(r'http://user:pass@testserver/', host='user:pass@testserver'))
|
||||
|
||||
Reference in New Issue
Block a user