mirror of
https://github.com/gophernicus/gophernicus.git
synced 2024-11-03 04:27:17 -05:00
Update menu.c: Fix JPEG detection.
The existing JPEG detection logic is too restrictive because it checks for the file header "FF D8 FF E0", which only matches JFIF-type JPEG images... Meanwhile EXIF JPEG images are more common these days. For reference: FF D8 = JPEG SOI (Start of Image) header FF-D8-FF-E0 = JFIF FF-D8-FF-E1 = EXIF FF-D8-FF-E2 = CIFF FF-D8-FF-E8 = SPIFF As you can see checking for the SOI and then FF matches all extent types of JPEG images. \o/
This commit is contained in:
parent
d7c297ae5f
commit
6206c24b7e
@ -264,7 +264,7 @@ char gopher_filetype(state *st, char *file, char magic)
|
||||
sstrncmp(buf, "GIF87a") == MATCH) return TYPE_GIF;
|
||||
|
||||
/* JPEG images */
|
||||
if (sstrncmp(buf, "\377\330\377\340") == MATCH) return TYPE_IMAGE;
|
||||
if (sstrncmp(buf, "\377\330\377") == MATCH) return TYPE_IMAGE;
|
||||
|
||||
/* PNG images */
|
||||
if (sstrncmp(buf, "\211PNG") == MATCH) return TYPE_IMAGE;
|
||||
|
Loading…
Reference in New Issue
Block a user