Fix logo upload - we need to rewind the bytestream after we read it

This commit is contained in:
Pea Tyczynska
2020-03-04 17:26:19 +00:00
parent 8ecccca6c2
commit 8a4618ffe0

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)