Page MenuHomePhabricator

Make the "Is this JSON?" DocumentEngine heuristic a little tighter
ClosedPublic

Authored by epriestley on Jul 27 2018, 6:29 PM.
Tags
None
Referenced Files
F17957574: D19544.id.diff
Fri, Aug 1, 6:24 AM
F17944403: D19544.diff
Thu, Jul 31, 10:00 AM
F17750635: D19544.diff
Tue, Jul 22, 3:56 AM
F17750191: D19544.diff
Tue, Jul 22, 2:55 AM
Unknown Object (File)
Jul 1 2025, 10:51 PM
Unknown Object (File)
Jul 1 2025, 10:30 PM
Unknown Object (File)
May 27 2025, 6:14 AM
Unknown Object (File)
May 26 2025, 9:53 AM
Subscribers
None

Details

Summary

See PHI749. Ref T13164. We currently misdetect files starting with [submodule ... as JSON.

Make this a bit stricter:

  • If the file is short, just see if it's actually literally real JSON.
  • If the file is long, give up.

This should get the right result in pretty much all the cases people care about, I think. We could make the long-file guesser better some day.

Test Plan

Detected a [submodule ... file (no longer JSON) and a {"duck": "quack"} file (still JSON).

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable