From 96deb0ccf92953b9903b670d02d8f906a6e447d1 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Wed, 20 Dec 2017 17:51:01 +0100 Subject: Prevent asciinema from being affected by file size limit Signed-off-by: Florian Pritz --- application/controllers/Main.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/application/controllers/Main.php b/application/controllers/Main.php index 2e8ab3851..59213de1b 100644 --- a/application/controllers/Main.php +++ b/application/controllers/Main.php @@ -187,6 +187,11 @@ class Main extends MY_Controller { $filesize_too_big = filesize($file) > $this->config->item('upload_max_text_size'); + if ($lexer == "asciinema") { + $output_cache->add(array("filedata" => $filedata), "file/fragments/asciinema-player"); + continue; + } + if (!$can_highlight || $filesize_too_big || !$lexer) { if (!$is_multipaste) { // prevent javascript from being executed and forbid frames @@ -222,14 +227,10 @@ class Main extends MY_Controller { } } - if ($lexer == "asciinema") { - $output_cache->add(array("filedata" => $filedata), "file/fragments/asciinema-player"); - } else { - $output_cache->add_function(function() use ($output_cache, $filedata, $lexer, $is_multipaste) { - $renderer = new \service\renderer($output_cache, $this->mfile, $this->data); - $renderer->highlight_file($filedata, $lexer, $is_multipaste); - }); - } + $output_cache->add_function(function() use ($output_cache, $filedata, $lexer, $is_multipaste) { + $renderer = new \service\renderer($output_cache, $this->mfile, $this->data); + $renderer->highlight_file($filedata, $lexer, $is_multipaste); + }); } // TODO: move lexers json to dedicated URL -- cgit v1.2.3-24-g4f1b