mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-04-25 17:14:48 +00:00
Fixed ValueError not raised (#5095)
Raised `ValueError` in `wagtail/images/utils.py` that was called but not raised I work for Semmle and I noticed these issues using our LGTM code analyzer https://lgtm.com/projects/g/wagtail/wagtail/alerts/?mode=tree&severity=error&ruleFocus=1505923886371
This commit is contained in:
parent
234ee703ed
commit
20f47ff50e
3 changed files with 10 additions and 1 deletions
|
|
@ -347,6 +347,7 @@ Contributors
|
|||
* Vladimir Knobel
|
||||
* Matt Collins
|
||||
* Thomas Elliott
|
||||
* damianosSemmle
|
||||
|
||||
Translators
|
||||
===========
|
||||
|
|
|
|||
|
|
@ -619,3 +619,11 @@ class TestBackgroundColorFilter(TestCase):
|
|||
file=get_test_image_file(),
|
||||
)
|
||||
self.assertRaises(ValueError, fil.run, image, BytesIO())
|
||||
|
||||
def test_invalid_length(self):
|
||||
fil = Filter(spec='width-400|bgcolor-1234')
|
||||
image = Image.objects.create(
|
||||
title="Test image",
|
||||
file=get_test_image_file(),
|
||||
)
|
||||
self.assertRaises(ValueError, fil.run, image, BytesIO())
|
||||
|
|
|
|||
|
|
@ -57,6 +57,6 @@ def parse_color_string(color_string):
|
|||
g = int(color_string[2:4], 16)
|
||||
b = int(color_string[4:6], 16)
|
||||
else:
|
||||
ValueError('Color string must be either 3 or 6 hexadecimal digits long')
|
||||
raise ValueError('Color string must be either 3 or 6 hexadecimal digits long')
|
||||
|
||||
return r, g, b
|
||||
|
|
|
|||
Loading…
Reference in a new issue