HomeSoftware Heritage

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

Description

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.

Details

Provenance
vlorentzAuthored on Jan 7 2021, 5:19 PM
vlorentzPushed on Jan 8 2021, 12:20 PM
Differential Revision
D4819: Fix TypeError caused by empty lists being passed as a string to re.sub.
Parents
rDWAPPS2ed38516a48b: package.json: Upgrade dependencies
Branches
Unknown
Tags
Unknown
Build Status
Buildable 18223
Build 28125: test-and-buildJenkins console · Jenkins