minetest / contentdb

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

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

Open Desour opened 1 month ago

Desour commented 1 month 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 1 month ago

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

imghdr is deprecated. Maybe filetype is a viable alternative.

rubenwardy commented 1 month 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 4 weeks ago

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