diff options
author | Florian Pritz <bluewind@xinu.at> | 2017-12-20 17:51:01 +0100 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2017-12-20 17:51:01 +0100 |
commit | 96deb0ccf92953b9903b670d02d8f906a6e447d1 (patch) | |
tree | 5996c9537fdfc027a77d41e655c1c7bcc672dcde /application/controllers | |
parent | 8124653a6f24e05b793631480b1feb727d6b54cd (diff) |
Prevent asciinema from being affected by file size limit
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application/controllers')
-rw-r--r-- | application/controllers/Main.php | 17 |
1 files 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 |