]> granicus.if.org Git - file/commitdiff
Don't print the mime type when only encoding was requested.
authorChristos Zoulas <christos@zoulas.com>
Sat, 11 Aug 2018 11:06:19 +0000 (11:06 +0000)
committerChristos Zoulas <christos@zoulas.com>
Sat, 11 Aug 2018 11:06:19 +0000 (11:06 +0000)
src/is_json.c

index a1a7de7ccdc8a8dad10f30b159a9b90c60abe241..f0710e1c9920199f11daca8bb79e06278d53aead 100644 (file)
@@ -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;