Merge pull request #3349 from alphagov/fix-logo-upload

Fix logo upload - we need to rewind the bytestream after we read it
This commit is contained in:
Pea M. Tyczynska
2020-03-04 17:32:15 +00:00
committed by GitHub

View File

@@ -86,7 +86,9 @@ class NoEmbeddedImagesInSVG:
self.message = message
def __call__(self, form, field):
if '<image' in field.data.stream.read().decode("utf-8"):
is_image_embedded = '<image' in field.data.stream.read().decode("utf-8")
field.data.stream.seek(0)
if is_image_embedded:
raise ValidationError(self.message)