nightjarnz

rename an actual (raster) image to .txt, or a text file to .jpeg or something

nightjarnz

it should still stop you from renaming totallyAnImage.txt to image.png and uploading it though. If it doesn't, please feel free to open an issue with steps to recreate on the github repo :)

nightjarnz

If you want something a bit more intense you'll probably need to write your own validator, checking magic numbers or something similar (e.g. like GNU file (1))

nightjarnz

the check is only to assert that the extension is known for that type. But e.g. if a jpeg is listed as a png, and both are image (i.e. not specific) then that won't fail.

nightjarnz

take something a bit more drastic. mime types won't prevent bad file extensions.