mirror of
https://github.com/nextcloud/server.git
synced 2024-08-26 05:54:48 +02:00
Merge pull request #4956 from nextcloud/endless-loop-on-invalid-asset
Stop infinit loop on invalid settings css/js file
This commit is contained in:
commit
7eb8b3cec1
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user