diff options
author | Morris Jobke <hey@morrisjobke.de> | 2017-02-24 18:29:05 -0600 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2017-03-10 14:44:01 +0100 |
commit | 3ca9d53194d2a52ea3798d447cd70ffc2e595fcf (patch) | |
tree | 0d15bd28a7069a3736e0354a44a57222e3bd715c /lib/private/Template | |
parent | c38f87e799c93942c79dfe972b74fa3c2860793d (diff) | |
download | nextcloud-server-3ca9d53194d2a52ea3798d447cd70ffc2e595fcf.tar.gz nextcloud-server-3ca9d53194d2a52ea3798d447cd70ffc2e595fcf.zip |
Fix SCSS usage in apps
* fix the web root detection of the ResourceLocator for apps
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'lib/private/Template')
-rwxr-xr-x | lib/private/Template/ResourceLocator.php | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/lib/private/Template/ResourceLocator.php b/lib/private/Template/ResourceLocator.php index e22ebdcab7d..9015bf5d97c 100755 --- a/lib/private/Template/ResourceLocator.php +++ b/lib/private/Template/ResourceLocator.php @@ -117,7 +117,38 @@ abstract class ResourceLocator { */ protected function append($root, $file, $webRoot = null, $throw = true) { if (!$webRoot) { - $webRoot = $this->mapping[$root]; + $tmpRoot = $root; + /* + * traverse the potential web roots upwards in the path + * + * example: + * - root: /srv/www/apps/myapp + * - available mappings: ['/srv/www'] + * + * First we check if a mapping for /srv/www/apps/myapp is available, + * then /srv/www/apps, /srv/www/apps, /srv/www, ... until we find a + * valid web root + */ + do { + if (isset($this->mapping[$tmpRoot])) { + $webRoot = $this->mapping[$tmpRoot]; + break; + } + + if ($tmpRoot === '/') { + $webRoot = ''; + $this->logger->error('ResourceLocator can not find a web root (root: {root}, file: {file}, webRoot: {webRoot}, throw: {throw})', [ + 'app' => 'lib', + 'root' => $root, + 'file' => $file, + 'webRoot' => $webRoot, + 'throw' => $throw ? 'true' : 'false' + ]); + break; + } + $tmpRoot = dirname($tmpRoot); + } while(true); + } $this->resources[] = array($root, $webRoot, $file); |