minetest / contentdb

A content database for Minetest mods, games, and more
https://content.minetest.net
GNU Affero General Public License v3.0
98 stars 47 forks source link

Can't upload screenshot, "isn't actually an image" #558

Open Desour opened 3 months ago

Desour commented 3 months ago

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

Here's an example, it's clearly a jpeg image, just ask file: default_lava

And it is, in fact, an image. Stop gaslighting me!

Relevant code, probably

https://github.com/minetest/contentdb/blob/master/app/logic/uploads.py

SmallJoker commented 3 months ago

https://docs.python.org/3/library/imghdr.html

imghdr is deprecated. Maybe filetype is a viable alternative.

rubenwardy commented 3 months ago

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

sfan5 commented 3 months ago

CDB already depends on Pillow, I'm sure it can determine the image type.

Wuzzy2 commented 1 week ago

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.".