OpenOversight
OpenOversight copied to clipboard
Fix all issues with image formats & add tests
Recently we had problems with certain image-types not being recognized by imghdr.what which leads to errors, because we use that function extensively before uploading the image to S3. Additionally we also have an ALLOWED_EXTENSION
config, which controls what image filename extensions are allowed when uploading an image.
Unfortunately it seems that https://github.com/lucyparsons/OpenOversight/pull/807 wasn't able to fix all the problems since we use the imghdr.what
in a lot of places. So I think we need to come up with a solution that brings our logic on which image-types are allowed and how they are determined into one place.
Further, we need to write tests with a number of test-images to make sure things aren't breaking again as already pointed out by @redshiftzero in https://github.com/lucyparsons/OpenOversight/pull/807#pullrequestreview-486390482
We should consider https://github.com/lucyparsons/OpenOversight/issues/369 and the related PR https://github.com/lucyparsons/OpenOversight/pull/691 as part of this issue. Ideally incorporate that PR into this work as well