Skip to content

Fix TypeError caused by empty lists being passed as a string to re.sub.

In make_api_response, empty lists were not JSONized because they were mistakenly detected as a None, which caused these empty lists to be passed to urlize_links_and_mails, which expects strings.

It caused a TypeError when calling re.sub() on it, which was catched so it still returned a result (and a correct one, since empty lists don't need substitution).

This commit removes the catch workaround and always passes the right type.

Resolves Sentry issue SWH-WEBAPP-H1

Test Plan

already covered by tests.


Migrated from D4819 (view on Phabricator)

Merge request reports