On 28/06/17 17:48, Daniel Axtens wrote:
The db limit is 255: we need to make sure we don't pass anything
longer in or it will throw an exception.
Signed-off-by: Daniel Axtens <d...@axtens.net>
Reviewed-by: Andrew Donnellan <andrew.donnel...@au1.ibm.com>
---
patchwork/parser.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/patchwork/parser.py b/patchwork/parser.py
index 80450c2e4860..46e6ca161574 100644
--- a/patchwork/parser.py
+++ b/patchwork/parser.py
@@ -225,7 +225,7 @@ def _find_series_by_references(project, mail):
for ref in refs:
try:
return SeriesReference.objects.get(
- msgid=ref, series__project=project).series
+ msgid=ref[:255], series__project=project).series
except SeriesReference.DoesNotExist:
continue
@@ -557,6 +557,7 @@ def find_comment_content(mail):
def find_submission_for_comment(project, refs):
for ref in refs:
+ ref = ref[:255]
# first, check for a direct reply
try:
submission = Submission.objects.get(project=project, msgid=ref)
@@ -934,7 +935,7 @@ def parse_mail(mail, list_id=None):
msgid = clean_header(mail.get('Message-Id'))
if not msgid:
raise ValueError("Broken 'Message-Id' header")
- msgid = msgid.strip()
+ msgid = msgid.strip()[:255]
author = find_author(mail)
subject = mail.get('Subject')
@@ -993,6 +994,7 @@ def parse_mail(mail, list_id=None):
# be possible to identify the relationship between patches
# as the earlier patch does not reference the later one.
for ref in refs + [msgid]:
+ ref = ref[:255]
# we don't want duplicates
try:
# we could have a ref to a previous series. (For
--
Andrew Donnellan OzLabs, ADL Canberra
andrew.donnel...@au1.ibm.com IBM Australia Limited
_______________________________________________
Patchwork mailing list
Patchwork@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/patchwork