Commit 02aba96a authored by Oliver Falk's avatar Oliver Falk

Merge branch 'devel' into 'master'

Redir to deadbeef if hash is wrong

See merge request !140
parents 2f691d57 911d0b56
Pipeline #1200 passed with stages
in 8 minutes and 16 seconds
......@@ -61,5 +61,8 @@ class Tester(TestCase): # pylint: disable=too-many-public-methods
"""
Test incorrect digest
"""
response = self.client.get('/avatar/%s' % 'x'*65)
self.assertEqual(response.status_code, 200, 'no 200 ok?')
response = self.client.get('/avatar/%s' % 'x'*65, follow=True)
self.assertRedirects(
response=response,
expected_url='/static/img/deadbeef.png',
msg_prefix='Why does an invalid hash not redirect to deadbeef?')
......@@ -24,11 +24,7 @@ urlpatterns = [ # pylint: disable=invalid-name
url(r'avatar/$', AvatarImageView.as_view(), name='avatar_view'),
url(
r'avatar/(?P<digest>\w*)',
TemplateView.as_view(
template_name='error.html',
extra_context={
'errormessage': 'Incorrect digest length',
})),
RedirectView.as_view(url='/static/img/deadbeef.png'), name='invalid_hash'),
url(
r'gravatarproxy/(?P<digest>\w*)',
GravatarProxyView.as_view(), name='gravatarproxy'),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment