From 4a8d9de07e65b93a2329e9f7176b3148f7d7bcef Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Thu, 21 Sep 2017 11:16:07 +0200 Subject: Fix detection of URL ending in slash CI trims tailing slashes from the URL and this should work just fine too. Signed-off-by: Florian Pritz --- application/controllers/Main.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/controllers/Main.php b/application/controllers/Main.php index e7775d6d2..279d34520 100644 --- a/application/controllers/Main.php +++ b/application/controllers/Main.php @@ -171,7 +171,7 @@ class Main extends MY_Controller { // autodetect the lexer for highlighting if the URL contains a / after the ID (/ID/) // /ID/lexer disables autodetection - $autodetect_lexer = !$lexer && substr_count(ltrim($this->uri->uri_string(), "/"), '/') >= 1; + $autodetect_lexer = !$lexer && preg_match('/^[^?]*\/(\?.*)?$/', $_SERVER['REQUEST_URI']); $autodetect_lexer = $is_multipaste ? true : $autodetect_lexer; if ($autodetect_lexer) { $lexer = $pygments->autodetect_lexer(); -- cgit v1.2.3-24-g4f1b