From 8c2d89de2090dc67c1bc1f5f0b171c7be56ee6e0 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Thu, 20 Oct 2022 21:11:00 +1100 Subject: [PATCH] Prevent name check on null attachment file (cherry picked from commit c4ed1e23a01f278d696c2853337bdde0a682c6c5) --- InvenTree/InvenTree/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/InvenTree/InvenTree/models.py b/InvenTree/InvenTree/models.py index 04b9c14bed..cd15800e55 100644 --- a/InvenTree/InvenTree/models.py +++ b/InvenTree/InvenTree/models.py @@ -385,7 +385,7 @@ class InvenTreeAttachment(models.Model): 'link': _('Missing external link'), }) - if self.attachment.name.lower().endswith('.svg'): + if self.attachment and self.attachment.name.lower().endswith('.svg'): self.attachment.file.file = self.clean_svg(self.attachment) super().save(*args, **kwargs)