From d1e9992d79f144838cbba803330be6631ee6064d Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Mon, 6 Jul 2020 13:22:32 +0200 Subject: [PATCH] exam: fix infinite recursion when no file extension --- teleforma/exam/models.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/teleforma/exam/models.py b/teleforma/exam/models.py index d9d8a7b0..9c33c3cb 100755 --- a/teleforma/exam/models.py +++ b/teleforma/exam/models.py @@ -517,8 +517,10 @@ def set_file_properties(sender, instance, **kwargs): if instance.file: trig_save = False if not instance.mime_type: - instance.mime_type = mimetype_file(instance.file.path) - trig_save = True + mime_type = mimetype_file(instance.file.path) + if mime_type: + instance.mime_type = mimetype_file(instance.file.path) + trig_save = True if not instance.sha1: instance.sha1 = sha1sum_file(instance.file.path) trig_save = True -- 2.39.5