mirror of
https://github.com/nextcloud/server.git
synced 2026-06-08 16:26:59 -04:00
Fix icon cacher url matching
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
parent
5c74423902
commit
aec0a6c096
1 changed files with 14 additions and 15 deletions
|
|
@ -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';
|
||||
} 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';
|
||||
$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) {
|
||||
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,
|
||||
|
|
|
|||
Loading…
Reference in a new issue