View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0000023 | file | General | public | 2018-07-30 15:38 | 2018-10-08 18:26 |
Reporter | vitalyisaev2 | Assigned To | christos | ||
Priority | normal | Severity | minor | Reproducibility | have not tried |
Status | resolved | Resolution | fixed | ||
Product Version | 5.34 | ||||
Fixed in Version | 5.35 | ||||
Summary | 0000023: JSON is determined as "text/plain" | ||||
Description | Hello! I think that JSON files should have "application/json" content-type according to RFC4627 (http://www.ietf.org/rfc/rfc4627.txt) Kind regards, Vitaly | ||||
Steps To Reproduce | [root@9826ba54a40a /]# cat /tmp/ololo.json { "abc": "edf", "json": "crab", "ololo": [ 1, 2, 3 ], "subcrab": { "name": "crab", "surname": "subcrab" } } [root@9826ba54a40a /]# file --version file-5.34 magic file from /etc/magic:/usr/share/misc/magic [root@9826ba54a40a /]# file --mime-type /tmp/ololo.json /tmp/ololo.json: text/plain | ||||
Tags | No tags attached. | ||||
|
|
|
Yes, but that would require something in file to be able to parse json (so that it can determine if it is json)... What about a json file that has a syntax error? Should it be recognized as json? |
|
Hi! I suppose that we should recognize it as json in all cases when it's possible. Even it has a syntax error. Of course this behaviour depends on json parser. |
|
Perhaps libmagic could use some lightweight library that will just validate JSON (without building whole deserialized object in memory)... I'm not sure if we are able to distinguish JSON with syntax error and arbitrary text file. From my point of view, falling back to "text/plain" with broken JSON would be a better option. |
|
Fixed on HEAD. |
|
Thank you, going to check it in a couple of days |
|
Sorry for the delay with response, I've checked it, works good. I think we can close this issue. |
|
Submitter verified it is fixed. |
Date Modified | Username | Field | Change |
---|---|---|---|
2018-07-30 15:38 | vitalyisaev2 | New Issue | |
2018-07-30 15:38 | vitalyisaev2 | File Added: ololo.json | |
2018-08-03 09:14 | christos | Assigned To | => christos |
2018-08-03 09:14 | christos | Status | new => assigned |
2018-08-03 09:15 | christos | Status | assigned => feedback |
2018-08-03 09:15 | christos | Note Added: 0000040 | |
2018-08-08 06:55 | anonymous | Note Added: 0000042 | |
2018-08-08 07:43 | vitalyisaev2 | Note Added: 0000043 | |
2018-08-08 07:43 | vitalyisaev2 | Status | feedback => assigned |
2018-08-11 11:06 | christos | Status | assigned => feedback |
2018-08-11 11:06 | christos | Note Added: 0000044 | |
2018-08-13 10:51 | vitalyisaev2 | Note Added: 0000050 | |
2018-08-13 10:51 | vitalyisaev2 | Status | feedback => assigned |
2018-10-08 14:24 | vitalyisaev2 | Note Added: 0000092 | |
2018-10-08 18:26 | christos | Status | assigned => resolved |
2018-10-08 18:26 | christos | Resolution | open => fixed |
2018-10-08 18:26 | christos | Fixed in Version | => 5.35 |
2018-10-08 18:26 | christos | Note Added: 0000094 |