Config logo: handle exception

This commit is contained in:
Emmanuel Viennet 2023-12-12 19:17:53 +01:00
parent d7d6d688ff
commit 8166fd1380

View File

@ -117,7 +117,11 @@ class Logo:
os.mkdir(self.dirpath) os.mkdir(self.dirpath)
def create(self, stream): def create(self, stream):
img_type = guess_image_type(stream) "enregistre logo"
try:
img_type = guess_image_type(stream)
except ValueError as exc:
raise ScoValueError("fichier logo invalide") from exc
if img_type not in scu.LOGOS_IMAGES_ALLOWED_TYPES: if img_type not in scu.LOGOS_IMAGES_ALLOWED_TYPES:
raise ScoValueError(f"type d'image invalide ({img_type})") raise ScoValueError(f"type d'image invalide ({img_type})")
self._set_format(img_type) self._set_format(img_type)