Closed RaSan147 closed 1 year ago
This happens, but rather rarely, and in general does not greatly affect the result.
Determining the type of file that does not have an extension is not an easy task.
There are libraries for this, such as python-magic
.
But it makes sense to have as few dependencies as possible.
I know that it is possible to determine the extension by checking the magic numbers signature, and maybe add this feature without using third party libraries later.
Suggestions: Check if filename provided by api, then content-disposition filename, as last resort check file-type for extension and use that with image.{ext} And finally just image.jpg (image viewer will detect)