From 31c01fa3da094897d2bffbbf2bd4848773c62c67 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Thu, 11 May 2023 17:51:55 +0200 Subject: fix(JSResourceLocator): Handle missing translations silently Signed-off-by: Ferdinand Thiessen --- lib/private/Template/JSResourceLocator.php | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'lib/private') diff --git a/lib/private/Template/JSResourceLocator.php b/lib/private/Template/JSResourceLocator.php index 120234146e1..61611c69b0f 100644 --- a/lib/private/Template/JSResourceLocator.php +++ b/lib/private/Template/JSResourceLocator.php @@ -99,21 +99,28 @@ class JSResourceLocator extends ResourceLocator { // gets turned into cwd. $app_path = realpath($app_path); - // missing translations files will be ignored - if (strpos($script, 'l10n/') === 0) { - $this->appendScriptIfExist($app_path, $script, $app_url); + // check combined files + if ($this->cacheAndAppendCombineJsonIfExist($app_path, $script.'.json', $app)) { return; } - if (!$this->cacheAndAppendCombineJsonIfExist($app_path, $script.'.json', $app)) { - $this->appendScriptIfExist($app_path, $script, $app_url); + // fallback to plain file location + if ($this->appendScriptIfExist($app_path, $script, $app_url)) { + return; } } catch (AppPathNotFoundException) { - $this->logger->error('Could not find resource {resource} to load', [ - 'resource' => $app . '/' . $script . '.js', - 'app' => 'jsresourceloader', - ]); + // pass (general error handling happens below) } + + // missing translations files will be ignored + if (strpos($script, 'l10n/') === 0) { + return; + } + + $this->logger->error('Could not find resource {resource} to load', [ + 'resource' => $app . '/' . $script . '.js', + 'app' => 'jsresourceloader', + ]); } /** -- cgit v1.2.3