summaryrefslogtreecommitdiffstats
path: root/application/controllers/file
diff options
context:
space:
mode:
Diffstat (limited to 'application/controllers/file')
-rw-r--r--application/controllers/file/file_default.php5
1 files changed, 5 insertions, 0 deletions
diff --git a/application/controllers/file/file_default.php b/application/controllers/file/file_default.php
index 28d83282e..15fb54832 100644
--- a/application/controllers/file/file_default.php
+++ b/application/controllers/file/file_default.php
@@ -252,6 +252,11 @@ class File_default extends MY_Controller {
$content = file_get_contents($file);
+ $linecount = count(explode("\n", $content));
+ if ($lexer === "json" && $linecount === 1) {
+ $content = json_encode(json_decode($content), JSON_PRETTY_PRINT);
+ }
+
if ($lexer == "ascii") {
// TODO: use exec safe and catch exception
$ret = (new \libraries\ProcRunner(array('ansi2html', '-p')))