mirror of
https://git.linux-kernel.at/oliver/ivatar.git
synced 2025-11-18 14:08:04 +00:00
Redir to deadbeef if hash is wrong
This commit is contained in:
@@ -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'),
|
||||
|
||||
Reference in New Issue
Block a user