Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pistol not print JSON data #34

Closed
RonanMacF opened this issue Aug 19, 2020 · 2 comments
Closed

pistol not print JSON data #34

RonanMacF opened this issue Aug 19, 2020 · 2 comments

Comments

@RonanMacF
Copy link

What is the thinking behind not print JSON data and instead displaying a message stating that it is JSON data?

@doronbehar
Copy link
Owner

That's a good question :) The issue is the mime type of a JSON file is application/json and not text/json or anything that would match text/*. See this table:

var internalWritersRegexMap = map[string] func(string, string) (func(w io.Writer) error, error) {
"text/*": NewChromaWriter,
"application/zip": NewArchiveLister,
"application/x-rar-compressed": NewArchiveLister,
"application/x-tar": NewArchiveLister,
"application/x-xz": NewArchiveLister,
"application/x-bzip2": NewArchiveLister,
"application/gzip": NewArchiveLister,
"application/x-lz4": NewArchiveLister,
"application/x-snappy-framed": NewArchiveLister,
"application/x-zstd": NewArchiveLister,
// TODO: Match brotli when libmagic supports it
}

Feel free @RonanMacF to try and a line there for application/json and use the NewChromaWriter as the key in that map.

@doronbehar
Copy link
Owner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants