From 0c6e4edc19fdfb960847c5600d3dbbdda73165b3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Julius=20H=C3=A4rtl?= Date: Thu, 15 Jun 2017 22:14:39 +0200 Subject: [PATCH] Fix theming app to also use the prefix MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- lib/private/Template/SCSSCacher.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/private/Template/SCSSCacher.php b/lib/private/Template/SCSSCacher.php index eccc65a5cc9..fe5a095c773 100644 --- a/lib/private/Template/SCSSCacher.php +++ b/lib/private/Template/SCSSCacher.php @@ -92,7 +92,7 @@ class SCSSCacher { $path = explode('/', $root . '/' . $file); $fileNameSCSS = array_pop($path); - $fileNameCSS = $this->getBaseUrlHash() . '-' . str_replace('.scss', '.css', $fileNameSCSS); + $fileNameCSS = $this->prependBaseurlPrefix(str_replace('.scss', '.css', $fileNameSCSS)); $path = implode('/', $path); @@ -119,7 +119,7 @@ class SCSSCacher { */ public function getCachedCSS($appName, $fileName) { $folder = $this->appData->getFolder($appName); - return $folder->getFile($fileName); + return $folder->getFile($this->prependBaseurlPrefix($fileName)); } /** @@ -292,12 +292,17 @@ class SCSSCacher { public function getCachedSCSS($appName, $fileName) { $tmpfileLoc = explode('/', $fileName); $fileName = array_pop($tmpfileLoc); - $fileName = $this->getBaseUrlHash() . '-' . str_replace('.scss', '.css', $fileName); + $fileName = $this->prependBaseurlPrefix(str_replace('.scss', '.css', $fileName)); return substr($this->urlGenerator->linkToRoute('core.Css.getCss', array('fileName' => $fileName, 'appName' => $appName)), strlen(\OC::$WEBROOT) + 1); } - private function getBaseUrlHash() { - return md5($this->urlGenerator->getBaseUrl()); + /** + * Prepend hashed base url to the css file + * @param $cssFile + * @return string + */ + private function prependBaseurlPrefix($cssFile) { + return md5($this->urlGenerator->getBaseUrl()) . '-' . $cssFile; } } -- 2.39.5