From: Christos Zoulas Date: Sat, 11 Aug 2018 11:06:19 +0000 (+0000) Subject: Don't print the mime type when only encoding was requested. X-Git-Tag: FILE5_35~57 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=293ab7c7da1bb4c669abc5fc83e0c4aa7292b8b5;p=file Don't print the mime type when only encoding was requested. --- diff --git a/src/is_json.c b/src/is_json.c index a1a7de7c..f0710e1c 100644 --- a/src/is_json.c +++ b/src/is_json.c @@ -31,7 +31,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$File: is_json.c,v 1.1 2018/08/11 11:02:47 christos Exp $") +FILE_RCSID("@(#)$File: is_json.c,v 1.2 2018/08/11 11:06:19 christos Exp $") #endif #include "magic.h" @@ -327,6 +327,10 @@ file_is_json(struct magic_set *ms, const struct buffer *b) if (!json_parse(&uc, ue)) return 0; + + if (mime == MAGIC_MIME_ENCODING) + return 1; + if (file_printf(ms, "%s", mime ? "application/json" : "JSON data") == -1) return -1;