Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Stop infinit loop on invalid settings css/js file
Don't try to find dirname of false...

Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen committed May 19, 2017
commit 4792867357723d52bda2f050ff2abcc3a605ee17
9 changes: 9 additions & 0 deletions lib/private/Template/CSSResourceLocator.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,15 @@ public function doFind($style) {
$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);
}
Expand Down
9 changes: 9 additions & 0 deletions lib/private/Template/JSResourceLocator.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,15 @@ public function doFind($script) {
$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);
}
Expand Down
8 changes: 8 additions & 0 deletions lib/private/Template/ResourceLocator.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,14 @@ protected function appendIfExist($root, $file, $webRoot = null) {
* @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;
/*
Expand Down