Generate file extensions for images which don't have them
Erisa opened this issue · 2 comments
Not all images have proper file extensions, since I believe their type is instead specified as a MIME type. Since the current download implementation downloads the files literally, those files don't have an extension and aren't recognized as images by the OS.
This feature would detect the type of image, and add an appropriate extension if needed.
Trouble at the moment seems to be extracting the MIME Type of an image from just it's URL. Browsers don't give anything more than that so there isn't much I can do.
One idea I had was to send a small, manual request to the URL just to grab the MIME Type from the headers, but not pull the entire file. Something like that isn't something I know how to do in JavaScript currently, but I suppose I can work it out.