aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2017-05-19 16:51:49 +0200
committerGitHub <noreply@github.com>2017-05-19 16:51:49 +0200
commit7eb8b3cec1738edb59fd3c3870d1747b6d2e1cd3 (patch)
treed3b5a8d4beefdf9a4fc552f4120440ecefee55b6 /lib/private
parent494cd2de5f22a1cfda6391d824d713d2a720390c (diff)
parent4792867357723d52bda2f050ff2abcc3a605ee17 (diff)
downloadnextcloud-server-7eb8b3cec1738edb59fd3c3870d1747b6d2e1cd3.tar.gz
nextcloud-server-7eb8b3cec1738edb59fd3c3870d1747b6d2e1cd3.zip
Merge pull request #4956 from nextcloud/endless-loop-on-invalid-asset
Stop infinit loop on invalid settings css/js file
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/Template/CSSResourceLocator.php9
-rw-r--r--lib/private/Template/JSResourceLocator.php9
-rwxr-xr-xlib/private/Template/ResourceLocator.php8
3 files changed, 26 insertions, 0 deletions
diff --git a/lib/private/Template/CSSResourceLocator.php b/lib/private/Template/CSSResourceLocator.php
index 5f210ef307a..0150449ac9f 100644
--- a/lib/private/Template/CSSResourceLocator.php
+++ b/lib/private/Template/CSSResourceLocator.php
@@ -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);
}
diff --git a/lib/private/Template/JSResourceLocator.php b/lib/private/Template/JSResourceLocator.php
index 32a01565c69..97a9eacedf5 100644
--- a/lib/private/Template/JSResourceLocator.php
+++ b/lib/private/Template/JSResourceLocator.php
@@ -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);
}
diff --git a/lib/private/Template/ResourceLocator.php b/lib/private/Template/ResourceLocator.php
index e82a77ba65f..4e733d28f26 100755
--- a/lib/private/Template/ResourceLocator.php
+++ b/lib/private/Template/ResourceLocator.php
@@ -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;
/*