From 77c7fa0c00c86e57fa3dbb7302fcb24b9e0a6768 Mon Sep 17 00:00:00 2001
From: Can Adrian Karadag <can@karadag.co>
Date: Mon, 11 Mar 2024 08:27:58 +0100
Subject: [PATCH] [BUGFIX] Proper URI generation in workspace preview for
 records

If a workspace is active, the URI for a record preview link did not consider to prefix additional arguments with a "&" separator.

Resolves: #103346
Releases: main, 12.4
Change-Id: I255c557593fab44482769c19f8c91d7f1980e20d
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/83395
Tested-by: Garvin Hicking <gh@faktor-e.de>
Reviewed-by: Garvin Hicking <gh@faktor-e.de>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: core-ci <typo3@b13.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
---
 typo3/sysext/workspaces/Classes/Hook/BackendUtilityHook.php | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/typo3/sysext/workspaces/Classes/Hook/BackendUtilityHook.php b/typo3/sysext/workspaces/Classes/Hook/BackendUtilityHook.php
index 9ade13c69bac..787feac33437 100644
--- a/typo3/sysext/workspaces/Classes/Hook/BackendUtilityHook.php
+++ b/typo3/sysext/workspaces/Classes/Hook/BackendUtilityHook.php
@@ -49,6 +49,9 @@ class BackendUtilityHook
             ->buildUriForWorkspaceSplitPreview($event->getPageId());
         $queryString = $uri->getQuery();
         if ($event->getAdditionalQueryParameters() !== []) {
+            if ($queryString !== '') {
+                $queryString .= '&';
+            }
             $queryString .= http_build_query($event->getAdditionalQueryParameters(), '', '&', PHP_QUERY_RFC3986);
         }
         // Reassemble encapsulated language id as query parameter, to open workspace preview in correct non-default language
-- 
GitLab