Issue Bug Closed

#106908Workspace Preview generates wrong URL for Live page

Sebastian Michaelsen 06/18/25, 13:28 updated 12/02/25, 14:21

Description

How to reproduce:
  • In a workspace, change the URL segment of a page
  • Use the “View” button to open the Preview offering a slider to compare the live version with the workspace version.
  • The live version shows a page not found error

That is because the PreviewController tries to generate the $liveUrl while the Context is still set to a workspace.

$liveUrl = $this->generateUrl($site, $pageUid, $parameters);

needs to be changed to

// temporarily set workspace aspect to live (0) to generate the live URL
$wsAspectBackup = $this->context->getAspect('workspace');
$this->context->setAspect('workspace', new WorkspaceAspect(0));
$liveUrl = $this->generateUrl($site, $pageUid, $parameters);
$this->context->setAspect('workspace', $wsAspectBackup);

I observed the issue in TYPO3 v13 and v12 and from looking at the code it’s present in v14 as well.

Reviews 2