From e465937cb8076cc82c9df74f1b0445d3b58156d0 Mon Sep 17 00:00:00 2001 From: Sabina Talipova Date: Wed, 8 Jun 2022 12:43:37 +1200 Subject: [PATCH] FIX Logout bug on shared preview page --- src/Controllers/ShareDraftController.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Controllers/ShareDraftController.php b/src/Controllers/ShareDraftController.php index 03ebacd..370e552 100644 --- a/src/Controllers/ShareDraftController.php +++ b/src/Controllers/ShareDraftController.php @@ -157,7 +157,11 @@ private function getRenderedPageByURL(string $url): HTTPResponse $variables = HTTPRequestBuilder::cleanEnvironment(Environment::getVariables()); $variables['_SERVER']['REQUEST_URI'] = $url; $variables['_SERVER']['REQUEST_METHOD'] = 'GET'; - $variables['_SERVER']['HTTP_USER_AGENT'] = 'CLI'; + $variables['_SERVER']['HTTP_USER_AGENT'] = + isset($variables['_SERVER']['HTTP_USER_AGENT']) && + $variables['_SERVER']['HTTP_USER_AGENT'] + ? $variables['_SERVER']['HTTP_USER_AGENT'] + : 'CLI'; Environment::setVariables($variables);