JSON parsing error when uploading Conan packages

🔥 Bug

It seems that some Conan packages uploads have a malformed json structure. The problem is that this structure is read during the upload and the JSON parser will fail.

That failure being not handled, it will bubble up and end up in a 500 response 😿

Screenshot_2022-01-12_at_16.51.40

We can backtrack the problem to this function.

🚒 Solution

Handle that parsing error gracefully and return a proper status code. 400 Bad Request with a proper error message