bengbengbalabalabeng opened a new issue, #811: URL: https://github.com/apache/fesod/issues/811
### Search before asking - [x] I searched in the [issues](https://github.com/apache/fesod/issues) and found nothing similar. ### Fesod version 1.3.0 ### JDK version 17 ### Operating system _No response_ ### Steps To Reproduce ```java File jpeg = new File("image-jpeg.jpeg"); try (InputStream is = new FileInputStream(jpeg)) { byte[] bytes = is.readAllBytes(); ImageData.ImageType imageType = FileTypeUtils.getImageType(bytes); log.info("imageType:{}", imageType); } ``` Image JPEG:  ### Current Behavior Result: null ### Expected Behavior Result: PICTURE_TYPE_JPEG ### Anything else? Cause: The method getImageType reads the first 28 bytes of the file and converts them into a 56-character Hex string. However, it attempts to look up the image type using Map.get(), which performs an exact string match. The keys in FILE_TYPE_MAP are short magic numbers (e.g., "ffd8ff" for JPEG, "89504e47" for PNG). Since a 56-character string can never equal a 6 or 8-character string, the method always returns null or the default type, rendering the utility ineffective. ### Are you willing to submit a PR? - [x] I'm willing to submit a PR! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
