contentdb
contentdb copied to clipboard
Can't upload screenshot, "isn't actually an image"
Summary
I'm trying to upload screenshots as jpg, by converting them from png with ffmeg. But contentdb fails to recognize them as image.
Steps to reproduce
- Take some png image. (For example:
default_lava.pngfrom devtest) - Convert it to jpg with ffmpeg:
ffmpeg -i input_file output_file - Try uploading it as a screenshot on contentdb.
- It fails with the message:
Uploaded image isn't actually an image
Here's an example, it's clearly a jpeg image, just ask file:
And it is, in fact, an image. Stop gaslighting me!
Relevant code, probably
https://github.com/minetest/contentdb/blob/master/app/logic/uploads.py
https://docs.python.org/3/library/imghdr.html
imghdr is deprecated. Maybe filetype is a viable alternative.
If I open it in GIMP and re-export it again, it works. So something is odd with the encoding that imghdr can't recognise
CDB already depends on Pillow, I'm sure it can determine the image type.
At the very least, the error message should be fixed. Something like: "This is either not an image or this image format is not supported by ContentDB.".