Skip to content

Commit 696a25f

Browse files
authored
Merge pull request #3725 from bansalnitish/fixUrl
Fixes #2953 - Url resolved with special characters
2 parents eb6dd0b + 8fdf569 commit 696a25f

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

readthedocs/profiles/urls/public.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88

99
urlpatterns = [
10-
url(r'^(?P<username>[\[email protected]]+)/$',
10+
url(r'^(?P<username>[+\[email protected]]+)/$',
1111
views.profile_detail,
1212
{'template_name': 'profiles/public/profile_detail.html'},
1313
name='profiles_profile_detail'),

readthedocs/rtd_tests/tests/test_urls.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,25 @@ def test_version_url_with_caps(self):
5151
kwargs={'type_': 'pdf', 'version_slug': u'1.4.X', 'project_slug': u'django'}
5252
)
5353
self.assertTrue(url)
54+
55+
56+
class TestProfileDetailURLs(TestCase):
57+
58+
def test_profile_detail_url(self):
59+
url = reverse(
60+
'profiles_profile_detail',
61+
kwargs={'username': 'foo+bar'}
62+
)
63+
self.assertEqual(url, '/profiles/foo+bar/')
64+
65+
url = reverse(
66+
'profiles_profile_detail',
67+
kwargs={'username': '[email protected]'}
68+
)
69+
self.assertEqual(url, '/profiles/[email protected]/')
70+
71+
url = reverse(
72+
'profiles_profile_detail',
73+
kwargs={'username': 'abc-def+ghi'}
74+
)
75+
self.assertEqual(url, '/profiles/abc-def+ghi/')

0 commit comments

Comments
 (0)