From 74d56d5f45836a5c0eeb0af48dbe48072319ecd6 Mon Sep 17 00:00:00 2001 From: HB9HIL Date: Fri, 13 Feb 2026 17:04:57 +0100 Subject: [PATCH] check for / in filepath to make sure path doesn't get broken --- application/libraries/Paths.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/application/libraries/Paths.php b/application/libraries/Paths.php index 15841feaf..3afaaccc7 100644 --- a/application/libraries/Paths.php +++ b/application/libraries/Paths.php @@ -34,11 +34,14 @@ class Paths } function cache_buster($filepath) { + // make sure $filepath starts with a slash + if (substr($filepath, 0, 1) !== '/') $filepath = '/' . $filepath; + $fullpath = $_SERVER['DOCUMENT_ROOT'] . $filepath; if (file_exists($fullpath)) { return base_url($filepath) . '?v=' . filemtime($fullpath); } else { - log_message('error', 'CACHE BUSTER - File does not exist: ' . $filepath); + log_message('error', 'CACHE BUSTER: File does not exist: ' . $fullpath); } return base_url($filepath); }