From bb8216cbc856867929a9c94557781f5b63b83b5f Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Sat, 30 Mar 2019 11:13:27 +0100 Subject: [PATCH 1/2] check if BasePath is empty to prevent mangeled up CSS path --- src/App.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/App.php b/src/App.php index c0afd514d0..3408241a1a 100644 --- a/src/App.php +++ b/src/App.php @@ -182,7 +182,11 @@ class App */ public function registerStylesheet($path) { - $url = str_replace($this->getBasePath() . DIRECTORY_SEPARATOR, '', $path); + if (!empty($this->getBasePath())) { + $url = str_replace($this->getBasePath() . DIRECTORY_SEPARATOR, '', $path); + } else { + $url = $path; + } $this->stylesheets[] = trim($url, '/'); } From 16f44a8237ca0ba0ceea47696cf3a6be306e575d Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Sun, 31 Mar 2019 08:53:25 +0200 Subject: [PATCH 2/2] dont check but only copy if BasePath is present --- src/App.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/App.php b/src/App.php index 3408241a1a..e55514fc73 100644 --- a/src/App.php +++ b/src/App.php @@ -182,13 +182,11 @@ class App */ public function registerStylesheet($path) { - if (!empty($this->getBasePath())) { - $url = str_replace($this->getBasePath() . DIRECTORY_SEPARATOR, '', $path); - } else { - $url = $path; + if (mb_strpos($path, $this->getBasePath() . DIRECTORY_SEPARATOR) == 0) { + $path = mb_substr($path, mb_strlen($this->getBasePath() . DIRECTORY_SEPARATOR)); } - $this->stylesheets[] = trim($url, '/'); + $this->stylesheets[] = trim($path, '/'); } /**