Merge pull request #22636 from nextcloud/bugfix/noid/initial-stte-cspv3

Make sure that getConfig is still called for browsers that do not support CSPv3
This commit is contained in:
Joas Schilling 2020-09-09 13:11:59 +02:00 committed by GitHub
commit e280c05053
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 14 deletions

View File

@ -194,7 +194,6 @@ class TemplateLayout extends \OC_Template {
$jsFiles = self::findJavascriptFiles(\OC_Util::$scripts);
$this->assign('jsfiles', []);
if ($this->config->getSystemValue('installed', false) && $renderAs != TemplateResponse::RENDER_AS_ERROR) {
if (\OC::$server->getContentSecurityPolicyNonceManager()->browserSupportsCspV3()) {
$jsConfigHelper = new JSConfigHelper(
\OC::$server->getL10N('lib'),
\OC::$server->query(Defaults::class),
@ -208,7 +207,9 @@ class TemplateLayout extends \OC_Template {
\OC::$server->getCapabilitiesManager(),
\OC::$server->query(IInitialStateService::class)
);
$this->assign('inline_ocjs', $jsConfigHelper->getConfig());
$config = $jsConfigHelper->getConfig();
if (\OC::$server->getContentSecurityPolicyNonceManager()->browserSupportsCspV3()) {
$this->assign('inline_ocjs', $config);
} else {
$this->append('jsfiles', \OC::$server->getURLGenerator()->linkToRoute('core.OCJS.getConfig', ['v' => self::$versionHash]));
}