diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2017-12-27 11:00:46 +0100 |
---|---|---|
committer | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2017-12-30 05:55:43 +0100 |
commit | fb6c5cc41618a476fc2ac47fb0f4fd137029ec62 (patch) | |
tree | a280c943448c049fdc6626c685d35dca0aa4b238 /lib/private | |
parent | ea858fcb553aff59f50e4dcabc42fc8c7c2f200d (diff) | |
download | nextcloud-server-fb6c5cc41618a476fc2ac47fb0f4fd137029ec62.tar.gz nextcloud-server-fb6c5cc41618a476fc2ac47fb0f4fd137029ec62.zip |
Fixed scss url rewriting
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/Template/SCSSCacher.php | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/lib/private/Template/SCSSCacher.php b/lib/private/Template/SCSSCacher.php index 8f6cb85a120..d7e2441f412 100644 --- a/lib/private/Template/SCSSCacher.php +++ b/lib/private/Template/SCSSCacher.php @@ -103,7 +103,17 @@ class SCSSCacher { $path = implode('/', $path); - $webDir = substr($path, strlen($this->serverRoot)+1); + // Detect if path is within an app path + $app_paths = $this->config->getSystemValue('apps_paths'); + foreach ($app_paths as $app_path) { + if(strpos($path, $app_path["path"]) === 0) { + $webDir = $app_path["url"].str_replace($app_path["path"], '', $path); + break; + } + } + if(is_null($webDir)) { + $webDir = substr($path, strlen($this->serverRoot)); + } try { $folder = $this->appData->getFolder($app); @@ -155,7 +165,7 @@ class SCSSCacher { } } } - return true; + return false; } catch(NotFoundException $e) { return false; } @@ -283,12 +293,7 @@ class SCSSCacher { */ private function rebaseUrls($css, $webDir) { $re = '/url\([\'"]([\.\w?=\/-]*)[\'"]\)/x'; - // OC\Route\Router:75 - if(($this->config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true')) { - $subst = 'url(\'../../'.$webDir.'/$1\')'; - } else { - $subst = 'url(\'../../../'.$webDir.'/$1\')'; - } + $subst = 'url(\''.$webDir.'/$1\')'; return preg_replace($re, $subst, $css); } @@ -299,6 +304,7 @@ class SCSSCacher { * @return string */ public function getCachedSCSS($appName, $fileName) { + //var_dump([$appName, $fileName]); $tmpfileLoc = explode('/', $fileName); $fileName = array_pop($tmpfileLoc); $fileName = $this->prependBaseurlPrefix(str_replace('.scss', '.css', $fileName)); |