diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2018-07-04 10:04:38 +0200 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2018-07-19 08:16:58 +0200 |
commit | 9e5885963c5dc09c20183732f0f94ca01598530e (patch) | |
tree | 92a3d5d2e9707644ec9c6b68ce0d3fe6d1f7165e /lib | |
parent | 8977c71f8842f19077fdd0bfe27a4f48f2bc4726 (diff) | |
download | nextcloud-server-9e5885963c5dc09c20183732f0f94ca01598530e.tar.gz nextcloud-server-9e5885963c5dc09c20183732f0f94ca01598530e.zip |
Fixed icons detection and caching
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Group/Group.php | 2 | ||||
-rw-r--r-- | lib/private/Template/IconsCacher.php | 18 |
2 files changed, 14 insertions, 6 deletions
diff --git a/lib/private/Group/Group.php b/lib/private/Group/Group.php index 7f114873995..0d54cf8e35a 100644 --- a/lib/private/Group/Group.php +++ b/lib/private/Group/Group.php @@ -90,7 +90,7 @@ class Group implements IGroup { public function getDisplayName() { if (is_null($this->displayName)) { - return $this->gid.'-name'; + return $this->gid; } return $this->displayName; } diff --git a/lib/private/Template/IconsCacher.php b/lib/private/Template/IconsCacher.php index 3f405cbf3c1..79c4b9d8ec0 100644 --- a/lib/private/Template/IconsCacher.php +++ b/lib/private/Template/IconsCacher.php @@ -45,7 +45,7 @@ class IconsCacher { protected $urlGenerator; /** @var string */ - private $iconVarRE = '/--([a-z-]+): url\("([a-z0-9-\/]+)[^;]+;/m'; + private $iconVarRE = '/--([a-z0-9-]+): url\(["\']([a-z0-9-\/]+)[^;]+;/m'; /** @var string */ private $fileName = 'icons-vars.css'; @@ -84,12 +84,17 @@ class IconsCacher { * @param string $css */ public function setIconsCss(string $css) { + try { - $data = $this->folder->getFile($this->fileName)->getContent(); + $currentData = $this->folder->getFile($this->fileName)->getContent(); } catch (NotFoundException $e) { - $data = ''; + $currentData = ''; } - $icons = $this->getIconsFromCss($data . $css); + + // remove :root + $currentData = str_replace([':root {', '}'], '', $currentData); + + $icons = $this->getIconsFromCss($currentData . $css); $data = ''; foreach ($icons as $icon => $url) { @@ -127,7 +132,10 @@ class IconsCacher { public function injectCss() { // Only inject once foreach (\OC_Util::$headers as $header) { - if (strpos($header['attributes']['href'], $this->fileName) !== false) { + if ( + array_key_exists('attributes', $header) && + array_key_exists('href', $header['attributes']) && + strpos($header['attributes']['href'], $this->fileName) !== false) { return; } } |