Open kolesnikov-pasha opened 6 months ago
yeah, right now it depends on extensions to determine type. If you have any suggestions on how to determine type from the file itself that would be helpful.
The one thing I have in my mind is to 1) check all caches for the key. If it is present then decide type based on cache type 2) if no cached image for this key, download file and decide its type based on the content, I guess it shouldn't be hard (for example, svg files always start with <svg and so on)
I'll try to research this question and make PR later this week
Maybe it is possible to use this tool or to port its part on Kotlin: https://imagemagick.org/script/identify.php
HTTP Content-Type
header could be a good source of information for this
HTTP
Content-Type
header could be a good source of information for this
Yeah that could help for network requests 👍
Some links could not have any extension and provide, for example, svg images. In this case, image won't be shown correctly.
Example of link: https://img.recraft.ai/k0Ksvp7ONUcklX29-XZ42n0cxZC4DkiR1UnHLgBHv0I/rs:fit:768:768:0/raw:1/plain/abs://staging/images/85e93fd8-a732-4cb6-aaac-45e9285a4aaf