]> git.ipfire.org Git - thirdparty/patchwork.git/commit
Fix parsing of un-numbered messages in series
authorDaniel Axtens <dja@axtens.net>
Wed, 16 Nov 2016 05:58:44 +0000 (16:58 +1100)
committerStephen Finucane <stephen@that.guru>
Fri, 18 Nov 2016 01:01:01 +0000 (01:01 +0000)
commit25a7aaec437bf39306563e4c62d7fcc95ddbeade
tree1fc9106e442ea65eb2f194249d64e58b9bf15924
parentc3137fe212d0eeaaf99a331d8d05cfac37896d38
Fix parsing of un-numbered messages in series

Say we are sent the following:

          - [PATCH 0/2] A sample series
            - [PATCH 1/2] test: Add some lorem ipsum
            - Random message with diff

We expect that:
 1) we parse normally without errors
 2) we get a series with a cover letter and a patch
 3) the random message is orphaned

What happens is that we get an integrity error, boiling down to:

(1048, "Column 'number' cannot be null")

This is caused because we believe that the random message belongs
to the series because of the headers, but because there are no
numbers in the Subject, we pass "None" into the number field of
SeriesPatch. That turns into a null, and rightly hits an integrity
error.

Fix this by requring that a message has a series _and_ a number
before we try to add it to the series.

Add a test to verify correctness.

Reported-by: Daniel Wagner <wagi@monom.org>
Signed-off-by: Daniel Axtens <dja@axtens.net>
Reviewed-by: Stephen Finucane <stephen@that.guru>
patchwork/parser.py
patchwork/tests/series/bugs-unnumbered.mbox [new file with mode: 0644]
patchwork/tests/test_series.py