Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Determine image file formats by checking file header (#36)
The image format was determined by checking the file extension parsed from the image path. However, a file's format is defined by its internal bit layout, not its extension. File extensions are merely human-readable metadata and do not necessarily reflect the actual contents of a file. For example, renaming a .jpg file to a different extension does not change its internal format and could potentially misrepresent the file as something else, such as a harmful executable. Relying solely on filenames to determine file formats is unreliable and may lead to incorrect results. In contrast, file headers contain unique, format-specific signatures that offer a more accurate and reliable method for identifying a file's true nature. Therefore, the handler has been updated to determine the image format by checking the file header, and the previous reliance on file extensions has been removed.
- Loading branch information