mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
check for / in filepath to make sure path doesn't get broken
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user