]> source.dussan.org Git - nextcloud-server.git/commitdiff
Stop infinit loop on invalid settings css/js file 4957/head
authorJoas Schilling <coding@schilljs.com>
Fri, 19 May 2017 09:28:40 +0000 (11:28 +0200)
committerJoas Schilling <coding@schilljs.com>
Fri, 19 May 2017 09:40:10 +0000 (11:40 +0200)
Don't try to find dirname of false...

Signed-off-by: Joas Schilling <coding@schilljs.com>
lib/private/Template/CSSResourceLocator.php
lib/private/Template/JSResourceLocator.php
lib/private/Template/ResourceLocator.php

index 5f210ef307a4933bd16888577696151c1df54caa..0150449ac9f7ebe2450b8e1133341e3ce113b0b4 100644 (file)
@@ -62,6 +62,15 @@ class CSSResourceLocator extends ResourceLocator {
                $style = substr($style, strpos($style, '/')+1);
                $app_path = \OC_App::getAppPath($app);
                $app_url = \OC_App::getAppWebPath($app);
+
+               if ($app_path === false && $app_url === false) {
+                       $this->logger->error('Could not find resource {resource} to load', [
+                               'resource' => $app . '/' . $style . '.css',
+                               'app' => 'cssresourceloader',
+                       ]);
+                       return;
+               }
+
                if(!$this->cacheAndAppendScssIfExist($app_path, $style.'.scss', $app)) {
                        $this->append($app_path, $style.'.css', $app_url);
                }
index 32a01565c699ddc6dfd25c95502686bd0428acb6..97a9eacedf562ccc274009dd6fde9d0962038a97 100644 (file)
@@ -80,6 +80,15 @@ class JSResourceLocator extends ResourceLocator {
                        $this->appendIfExist($app_path, $script . '.js', $app_url);
                        return;
                }
+
+               if ($app_path === false && $app_url === false) {
+                       $this->logger->error('Could not find resource {resource} to load', [
+                               'resource' => $app . '/' . $script . '.js',
+                               'app' => 'jsresourceloader',
+                       ]);
+                       return;
+               }
+
                if (!$this->cacheAndAppendCombineJsonIfExist($app_path, $script.'.json', $app)) {
                        $this->append($app_path, $script . '.js', $app_url);
                }
index e82a77ba65f0681806962bc405158c8a327ee226..4e733d28f266da875bc268682786cd83cad662ee 100755 (executable)
@@ -116,6 +116,14 @@ abstract class ResourceLocator {
         * @throws ResourceNotFoundException Only thrown when $throw is true and the resource is missing
         */
        protected function append($root, $file, $webRoot = null, $throw = true) {
+
+               if (!is_string($root)) {
+                       if ($throw) {
+                               throw new ResourceNotFoundException($file, $webRoot);
+                       }
+                       return;
+               }
+
                if (!$webRoot) {
                        $tmpRoot = $root;
                        /*