From 8166fd1380e7aa0598f20405a6ef9dd65e312990 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Tue, 12 Dec 2023 19:17:53 +0100 Subject: [PATCH] Config logo: handle exception --- app/scodoc/sco_logos.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/scodoc/sco_logos.py b/app/scodoc/sco_logos.py index 04be70bed..8f48f7443 100644 --- a/app/scodoc/sco_logos.py +++ b/app/scodoc/sco_logos.py @@ -117,7 +117,11 @@ class Logo: os.mkdir(self.dirpath) 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: raise ScoValueError(f"type d'image invalide ({img_type})") self._set_format(img_type)