diff options
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, |