]> git.lizzy.rs Git - plan9front.git/commitdiff
file: detect webp files (thanks kemal)
authorcinap_lenrek <cinap_lenrek@felloff.net>
Sat, 3 Apr 2021 17:32:47 +0000 (19:32 +0200)
committercinap_lenrek <cinap_lenrek@felloff.net>
Sat, 3 Apr 2021 17:32:47 +0000 (19:32 +0200)
this patch adds a small check to the "iff" function, so this
way file can detect webp files. tested with a webp file i
found randomly.

sys/src/cmd/file.c

index 2e53dbee892cc154f31b16eedd025b629e543249..ba34eb009a0d8a8f58a13242fc5adc82b55360ea 100644 (file)
@@ -962,6 +962,8 @@ iff(void)
                        print("%s\n", mime? "audio/wave": "wave audio");
                else if (strncmp((char*)buf+8, "AVI ", 4) == 0)
                        print("%s\n", mime? "video/avi": "avi video");
+               else if (strncmp((char*)buf+8, "WEBP", 4) == 0)
+                       print("%s\n", mime? "image/webp": "webp image");
                else
                        print("%s\n", mime? OCTET : "riff file");
                return 1;