diff options
author | Julius Härtl <jus@bitgrid.net> | 2018-01-26 17:03:22 +0100 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2018-01-26 17:03:22 +0100 |
commit | 5eae4819bfaf69c66957dc1d723608b457fd4106 (patch) | |
tree | e5311d01fd733c8c4e6a46f904821a821c4c9a21 /lib/private/Template/SCSSCacher.php | |
parent | 92e93704be82d30a759e7cf3b58c2be9ac0c2e53 (diff) | |
download | nextcloud-server-5eae4819bfaf69c66957dc1d723608b457fd4106.tar.gz nextcloud-server-5eae4819bfaf69c66957dc1d723608b457fd4106.zip |
Make sure that injected variables do not break the CSS generation
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'lib/private/Template/SCSSCacher.php')
-rw-r--r-- | lib/private/Template/SCSSCacher.php | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/private/Template/SCSSCacher.php b/lib/private/Template/SCSSCacher.php index dd3870b861a..1c4650ea1b7 100644 --- a/lib/private/Template/SCSSCacher.php +++ b/lib/private/Template/SCSSCacher.php @@ -63,6 +63,9 @@ class SCSSCacher { /** @var ICache */ protected $depsCache; + /** @var null|string */ + protected $injectedVariables = null; + /** * @param ILogger $logger * @param Factory $appDataFactory @@ -268,10 +271,22 @@ class SCSSCacher { * @return string SCSS code for variables from OC_Defaults */ private function getInjectedVariables() { + if ($this->injectedVariables !== null) + return $this->injectedVariables; $variables = ''; foreach ($this->defaults->getScssVariables() as $key => $value) { $variables .= '$' . $key . ': ' . $value . ';'; } + + // check for valid variables / otherwise fall back to defaults + try { + $scss = new Compiler(); + $scss->compile($variables); + $this->injectedVariables = $variables; + } catch (ParserException $e) { + $this->logger->error($e, ['app' => 'core']); + } + return $variables; } |