]> git.ipfire.org Git - thirdparty/patchwork.git/commit
REST: Don't error if a versioned field we would remove is absent
authorDaniel Axtens <dja@axtens.net>
Fri, 20 Aug 2021 14:57:58 +0000 (00:57 +1000)
committerStephen Finucane <stephen@that.guru>
Fri, 20 Aug 2021 21:55:48 +0000 (22:55 +0100)
commit5c22f9d8fcc72deec7d8beaefc97207ea8fc646d
treee3664fcb058418d3430a4113f1ffda4a265f029f
parent8a6304b51879115d15bff9723e59ba6a51958151
REST: Don't error if a versioned field we would remove is absent

We remove fields that shouldn't be seen on old versions of the API.
This was done with `pop(field name)`, which will throw an exception
if the named field is absent from the data. However, sometimes if
a patch request is via an old API version, we hit this line without
ever having the field present.

This is odd, but not harmful and we definitely shouldn't 500.

Signed-off-by: Daniel Axtens <dja@axtens.net>
[stephenfin: Merge test into bug fix]
Signed-off-by: Stephen Finucane <stephen@that.guru>
Tested-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
Fixes: d944f17ec059 ("REST: Use versioning for modified responses")
Closes: #423
patchwork/api/base.py
patchwork/tests/api/test_patch.py