Skip to content

Commit

Permalink
Merge pull request #3725 from bansalnitish/fixUrl
Browse files Browse the repository at this point in the history
Fixes #2953 - Url resolved with special characters
  • Loading branch information
humitos authored May 10, 2018
2 parents eb6dd0b + 8fdf569 commit 696a25f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion readthedocs/profiles/urls/public.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


urlpatterns = [
url(r'^(?P<username>[\[email protected]]+)/$',
url(r'^(?P<username>[+\[email protected]]+)/$',
views.profile_detail,
{'template_name': 'profiles/public/profile_detail.html'},
name='profiles_profile_detail'),
Expand Down
22 changes: 22 additions & 0 deletions readthedocs/rtd_tests/tests/test_urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,25 @@ def test_version_url_with_caps(self):
kwargs={'type_': 'pdf', 'version_slug': u'1.4.X', 'project_slug': u'django'}
)
self.assertTrue(url)


class TestProfileDetailURLs(TestCase):

def test_profile_detail_url(self):
url = reverse(
'profiles_profile_detail',
kwargs={'username': 'foo+bar'}
)
self.assertEqual(url, '/profiles/foo+bar/')

url = reverse(
'profiles_profile_detail',
kwargs={'username': '[email protected]'}
)
self.assertEqual(url, '/profiles/[email protected]/')

url = reverse(
'profiles_profile_detail',
kwargs={'username': 'abc-def+ghi'}
)
self.assertEqual(url, '/profiles/abc-def+ghi/')

0 comments on commit 696a25f

Please sign in to comment.