code: plan9front

Download patch

ref: d41c867696019e4408431230d8fae0dcf7603dc4
parent: 958b4764994eb874ef0382f86f6dfe6ee5db2cf9
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sat Apr 3 15:32:47 EDT 2021

file: detect webp files (thanks kemal)

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.

--- a/sys/src/cmd/file.c
+++ b/sys/src/cmd/file.c
@@ -962,6 +962,8 @@
 			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;