Review main Merged

89758[BUGFIX] Set live context when generating $liveUrl in PreviewController

Sebastian Michaelsen CR +2 V +2 Easy +10 −5 updated 08/14/25, 10:09

Commit message

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Oli Bartsch +1
  • Verified V +2 Done
    • Benni Mack +2
    • Oli Bartsch +1
    • core-ci +1 CI

Issues 1

Files 1

Review log 1114

  1. Sebastian Michaelsen uploaded patch set 1 06/18/25, 13:42

  2. core-ci voted on patch set 1 V +1 06/18/25, 13:49 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/80469

  3. Markus Klein voted on patch set 1 CR +1 06/18/25, 13:57

  4. Benjamin Franzke commented on patch set 1 06/19/25, 11:28

    PreviewController.php:139

    I think this hides a bug in the resolution or URL generation. The URL should be fine even if workspace is != 0, since `ADMCMD_prev=LIVE` ensures that the live URL is shown. Can you share more details on the page not found error that is mentioned in https://forge.typo3.org/issues/106908 or a reproducible example? I can not reproduce this issue. (not even if I rename a page and change the slug).
  5. Amir Arends commented on patch set 1 06/25/25, 13:39

    PreviewController.php:139 Reply

    I was able to reproduce the issue, and the logic behind it is fairly straightforward. The `PreviewController` generates the URI using the PageRouter. The `PageRouter`, in turn, loads the page via the PageRepository. Inside `PageRepository`, the following overlay logic is used: ``` if ($row) { $this->versionOL('pages', $row); ... } ``` The method `versionOL()` returns early if the workspace ID from the current context is <= 0: ``` if ((int)$this->context->getPropertyFromAspect('workspace', 'id') <= 0) { return; } ``` `ADMCMD_prev=LIVE` is not supported by `PageRouter` and `PageRepository` and a result, we receive a context-sensitive generation by `PageRouter`.
  6. Benni Mack commented on patch set 1 08/13/25, 17:22

    PreviewController.php:139 Reply

    Thanks for digging Amir. This in turn means we should a) hand in a Page object into the PageRouter and/or b) hand in the custom Context with the overriden workspace Aspect into generateUrl() which in turn hands it into the PageRouter which in turn is going to be used in PageRepository. so: similar place, cleaner code instead of overriding the global $this->context Context object.
  7. Benni Mack uploaded patch set 2 CR +1 V +1 08/14/25, 09:35

  8. Benni Mack commented on patch set 2 CR +1 V +1 08/14/25, 09:38

    PreviewController.php:139 Reply

    adapted the code to show what we can do with custom contexts!
  9. core-ci voted on patch set 2 V +1 08/14/25, 09:43 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/83367

  10. Benni Mack commented on patch set 3 CR +1 V +1 08/14/25, 09:43

    Published edit on patch set 2.
  11. Oli Bartsch voted on patch set 3 CR +1 V +1 08/14/25, 09:45

  12. core-ci voted on patch set 3 V +1 08/14/25, 09:50 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/83368

  13. Benni Mack voted on patch set 3 CR +2 V +2 08/14/25, 10:09

  14. Benni Mack merged patch set 4 08/14/25, 10:09