Fix theming app to also use the prefix

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl 2017-06-15 22:14:39 +02:00
parent f039ba7480
commit 517dfdda0d
No known key found for this signature in database
GPG key ID: 4C614C6ED2CDE6DF

View file

@ -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;
}
}