diff --git a/apps/theming/lib/Controller/ThemingController.php b/apps/theming/lib/Controller/ThemingController.php index 4789533564..3ac1f3316e 100644 --- a/apps/theming/lib/Controller/ThemingController.php +++ b/apps/theming/lib/Controller/ThemingController.php @@ -379,6 +379,9 @@ class ThemingController extends Controller { } $response = new FileDisplayResponse($file); + $csp = new Http\ContentSecurityPolicy(); + $csp->allowInlineStyle(); + $response->setContentSecurityPolicy($csp); $response->cacheFor(3600); $response->addHeader('Content-Type', $this->config->getAppValue($this->appName, $key . 'Mime', '')); $response->addHeader('Content-Disposition', 'attachment; filename="' . $key . '"'); diff --git a/apps/theming/tests/Controller/ThemingControllerTest.php b/apps/theming/tests/Controller/ThemingControllerTest.php index 93a1e040b4..bb154fbb9b 100644 --- a/apps/theming/tests/Controller/ThemingControllerTest.php +++ b/apps/theming/tests/Controller/ThemingControllerTest.php @@ -764,6 +764,9 @@ class ThemingControllerTest extends TestCase { $expected->cacheFor(3600); $expected->addHeader('Content-Type', 'text/svg'); $expected->addHeader('Content-Disposition', 'attachment; filename="logo"'); + $csp = new Http\ContentSecurityPolicy(); + $csp->allowInlineStyle(); + $expected->setContentSecurityPolicy($csp); @$this->assertEquals($expected, $this->themingController->getImage('logo')); } @@ -789,6 +792,9 @@ class ThemingControllerTest extends TestCase { ->willReturn('image/png'); @$expected = new Http\FileDisplayResponse($file); + $csp = new Http\ContentSecurityPolicy(); + $csp->allowInlineStyle(); + $expected->setContentSecurityPolicy($csp); $expected->cacheFor(3600); $expected->addHeader('Content-Type', 'image/png'); $expected->addHeader('Content-Disposition', 'attachment; filename="background"');