aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Finucane <stephen@that.guru>2019-07-07 17:10:42 +0100
committerStephen Finucane <stephen@that.guru>2020-03-02 17:07:21 +0000
commitb8a1673e356f2ad49f83eff82262b8d3c066f2fd (patch)
tree59a959034f2a7cb4ba43bf25f73575de1e8e1bee
parent563557a2ef846248000bd8160e88d0d922772400 (diff)
downloadpatchwork-b8a1673e356f2ad49f83eff82262b8d3c066f2fd.tar
patchwork-b8a1673e356f2ad49f83eff82262b8d3c066f2fd.tar.gz
models: Handle unset 'Submission.content'
It's unlikely but 'Submission.content' is nullable and we weren't handling this here. Fix that. Signed-off-by: Stephen Finucane <stephen@that.guru> Fixes: 7f6685a2a ("Fix CRLF newlines upon submission changes")
-rw-r--r--patchwork/models.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/patchwork/models.py b/patchwork/models.py
index be71d40..08ee341 100644
--- a/patchwork/models.py
+++ b/patchwork/models.py
@@ -347,7 +347,9 @@ class EmailMixin(models.Model):
# message content to '\r\n'. We need to fix them to avoid problems,
# especially as git complains about malformed patches when PW runs
# on PY2
- self.content = self.content.replace('\r\n', '\n')
+ if self.content:
+ self.content = self.content.replace('\r\n', '\n')
+
super(EmailMixin, self).save(*args, **kwargs)
class Meta: