diff options
author | Julius Härtl <jus@bitgrid.net> | 2018-10-29 12:09:30 +0100 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2018-10-29 12:09:30 +0100 |
commit | aec0a6c096becad93677179c439740d1da42c68f (patch) | |
tree | 20f3509bc924d670557f9529369271f790c6354d /lib | |
parent | 5c74423902abc61ac5dc72c09d6318653eafe2b7 (diff) | |
download | nextcloud-server-aec0a6c096becad93677179c439740d1da42c68f.tar.gz nextcloud-server-aec0a6c096becad93677179c439740d1da42c68f.zip |
Fix icon cacher url matching
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Template/IconsCacher.php | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/lib/private/Template/IconsCacher.php b/lib/private/Template/IconsCacher.php index c1a78a567f9..e5dd8633079 100644 --- a/lib/private/Template/IconsCacher.php +++ b/lib/private/Template/IconsCacher.php @@ -47,7 +47,7 @@ class IconsCacher { protected $urlGenerator; /** @var string */ - private $iconVarRE = '/--(icon-[a-zA-Z0-9-]+):\s?url\(["\']?([a-zA-Z0-9-_\~\/\.\?\=\:\;\+\,]+)[^;]+;/m'; + private $iconVarRE = '/--(icon-[a-zA-Z0-9-]+):\s?url\(["\']?([a-zA-Z0-9-_\~\/\.\?\&\=\:\;\+\,]+)[^;]+;/m'; /** @var string */ private $fileName = 'icons-vars.css'; @@ -142,21 +142,20 @@ class IconsCacher { $base = $this->getRoutePrefix() . '/svg/'; $cleanUrl = \substr($url, \strlen($base)); if (\strpos($url, $base . 'core') === 0) { - $cleanUrl = \substr($cleanUrl, \strlen('core'), \strpos($cleanUrl, '?')-\strlen('core')); - $parts = \explode('/', $cleanUrl); - $color = \array_pop($parts); - $cleanUrl = \implode('/', $parts); - $location = \OC::$SERVERROOT . '/core/img/' . $cleanUrl . '.svg'; + $cleanUrl = \substr($cleanUrl, \strlen('core')); + if (\preg_match('/\/([a-zA-Z0-9-_\~\/\.\=\:\;\+\,]+)\?color=([0-9a-fA-F]{3,6})/', $cleanUrl, $matches)) { + list(,$cleanUrl,$color) = $matches; + $location = \OC::$SERVERROOT . '/core/img/' . $cleanUrl . '.svg'; + } } elseif (\strpos($url, $base) === 0) { - $cleanUrl = \substr($cleanUrl, 0, \strpos($cleanUrl, '?')); - $parts = \explode('/', $cleanUrl); - $app = \array_shift($parts); - $color = \array_pop($parts); - $cleanUrl = \implode('/', $parts); - $location = \OC_App::getAppPath($app) . '/img/' . $cleanUrl . '.svg'; - if ($app === 'settings') { - $location = \OC::$SERVERROOT . '/settings/img/' . $cleanUrl . '.svg'; + if(\preg_match('/([A-z0-9\_\-]+)\/([a-zA-Z0-9-_\~\/\.\=\:\;\+\,]+)\?color=([0-9a-fA-F]{3,6})/', $cleanUrl, $matches)) { + list(,$app,$cleanUrl, $color) = $matches; + $location = \OC_App::getAppPath($app) . '/img/' . $cleanUrl . '.svg'; + if ($app === 'settings') { + $location = \OC::$SERVERROOT . '/settings/img/' . $cleanUrl . '.svg'; + } } + } return [ $location, |