#248 Handle exception thrown from //somestring.
Merged by atelic. Opened by atelic.
atelic/fedora-hubs fix/int-exception  into  develop

Download 248.patch

Calling int() on a string raises a ValueError, return 404 instead.

I'm :thumbsup: to the change but a little surprised on how we trigger this, since the only case I can think of is if idx is None

This was triggered from some dev data in fmn.sse where the img src attribute was not a full url and was trying to make a GET to //fake_image.png.

This is just a preventative measure so if we somehow get a messed up url from the streaming server, it doesn't crash the app.

Another way we could re-enforce our app is by specifying that idx must be an int in the routing, for example at https://pagure.io/fork/atelic/fedora-hubs/blob/fix/int-exception/f/hubs/app.py#_366 put <int:idx> in the routing itself :)

@pingou might as well change all the routes to use <int:idx>

@skrzepto that was my proposal indeed :)

rebased

:thumbsup: for me

Do we want to go belt and suspenders and add the original fix as well?

rebased

Why not?

Still looking good to me :)

Pull-Request has been merged by atelic

Metadata