From 250d76ce189bc24b646e197716ef47abf2da037c Mon Sep 17 00:00:00 2001 From: Niklas Droste Date: Thu, 14 Jan 2021 13:29:45 +0100 Subject: [PATCH] Bugfix: Include dimensionIdentifier in cache key --- Classes/Controller/JavaScriptController.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Classes/Controller/JavaScriptController.php b/Classes/Controller/JavaScriptController.php index 7ff1bcb..557db72 100644 --- a/Classes/Controller/JavaScriptController.php +++ b/Classes/Controller/JavaScriptController.php @@ -52,8 +52,8 @@ class JavaScriptController extends RestController */ protected $cookieName; - public function initializeRenderJavaScriptAction() { - + public function initializeRenderJavaScriptAction() + { $this->response->setComponentParameter(SetHeaderComponent::class, 'Cache-Control', 'max-age=0, private, must-revalidate'); } @@ -73,8 +73,9 @@ public function renderJavaScriptAction(array $dimensions = []) ); $cookie = json_decode($this->request->getHttpRequest()->getCookieParams()[$this->cookieName], true); + $consents = isset($cookie['consents'][$dimensionIdentifier]) ? $cookie['consents'][$dimensionIdentifier] : $cookie['consents']['default'] ?? $cookie['consents']; - $cacheIdentifier = 'kd_gdpr_cc_' . sha1(json_encode($consents)); + $cacheIdentifier = 'kd_gdpr_cc_' . sha1(json_encode($consents) . $dimensionIdentifier); if ($this->cache->has($cacheIdentifier)) { $this->redirect('downloadGeneratedJavaScript', null, null, ['hash' => $cacheIdentifier]);