Review main Merged

63252[BUGFIX] Force scheme if forceAbsoluteUrl.scheme is set

Nikita Hovratov CR +2 V +2 Easy +22 −7 updated 11/22/23, 21:49

Commit message

Allow overriding the scheme with forceAbsoluteUrl even if the page
is not protected.

Also the case is now covered where a scheme of a full URL with a path
should be changed. The path in now correctly prepended by a slash.

Review

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

Issues 1

Files 3

Review log 2733

Show 68 earlier messages
  1. Nikita Hovratov uploaded patch set 1 02/15/20, 11:59

  2. TYPO3com voted on patch set 1 V +1 02/15/20, 12:15 Completed build in 15m 55s on Sat, 15 Feb, 12:15 PM Test Summary: 71300 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-110

  3. Benni Mack updated the commit message in patch set 2 04/06/20, 09:43

  4. TYPO3com voted on patch set 2 V +1 04/06/20, 10:16 Completed build in 22m 25s on Mon, 6 Apr, 10:16 AM Test Summary: 73372 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-2223

  5. Georg Ringer commented on patch set 2 04/07/20, 04:16

    I guess this can be breaking for 9.5, would like to avoid that!
  6. Josef Glatz commented on patch set 2 V -1 CR -1 04/07/20, 05:33

    My test scenario fails * TYPO3 10.4.0-dev (master) * active site configuration with base "http://feloginpw.master10.t3.docker/"; page = PAGE page.1 = TEXT # UID 15 is subpage within the same pagetree with page slug "/asdf" page.1.typolink.parameter = 15 page.1.typolink.returnLast = url page.1.typolink.forceAbsoluteUrl = 1 page.1.typolink.forceAbsoluteUrl.scheme = https results in: http://feloginpw.master10.t3.docker/asdf
  7. Josef Glatz commented on patch set 2 04/07/20, 05:34

    I'm asking me also if such an option is necessary anymore with the usage of a site configuration > @Benni: didn't tested it so far in 9.5 branch
  8. Josef Glatz commented on patch set 2 04/08/20, 09:53

    > Patch Set 2: Verified-1 Code-Review-1 > > My test scenario fails > > * TYPO3 10.4.0-dev (master) > * active site configuration with base "http://feloginpw.master10.t3.docker/"; > > page = PAGE > page.1 = TEXT > # UID 15 is subpage within the same pagetree with page slug "/asdf" > page.1.typolink.parameter = 15 > page.1.typolink.returnLast = url > page.1.typolink.forceAbsoluteUrl = 1 > page.1.typolink.forceAbsoluteUrl.scheme = https > > results in: > > http://feloginpw.master10.t3.docker/asdf @Nikita, can you reproduce my outlined scenario?
  1. Nikita Hovratov commented on patch set 2 04/08/20, 11:00

    > Patch Set 2: > > > Patch Set 2: Verified-1 Code-Review-1 > > > > My test scenario fails > > > > * TYPO3 10.4.0-dev (master) > > * active site configuration with base "http://feloginpw.master10.t3.docker/"; > > > > page = PAGE > > page.1 = TEXT > > # UID 15 is subpage within the same pagetree with page slug "/asdf" > > page.1.typolink.parameter = 15 > > page.1.typolink.returnLast = url > > page.1.typolink.forceAbsoluteUrl = 1 > > page.1.typolink.forceAbsoluteUrl.scheme = https > > > > results in: > > > > http://feloginpw.master10.t3.docker/asdf > > @Nikita, can you reproduce my outlined scenario? Hi josef, seems this only should work for access restricted pages. Additionaly i found this commit https://review.typo3.org/58063 Benni wrote there: As for the linking process: - typolink.forceAbsoluteUrl is used to generate the full URL to a target page - typolink.forceAbsoluteUrl.scheme is only applicable if the site base of the target does not explicitly define a scheme - If you link to a different page tree or to a different host/scheme, it is always treated as absolute. Seems like this option is not really needed with site configuration? I don't know if the person who filed that issue had old ts setup or site config. Besides that this patch only fixes the part, where the wrong path was beeing generated. The "/" after the host was missing resulting in http://feloginpw.master10.t3.dockerasdf in your example.
  2. Josef Glatz voted on patch set 2 V 0 CR 0 04/09/20, 10:14

  3. Benni Mack updated the commit message in patch set 3 05/25/20, 18:46

  4. Daniel Goerz commented on patch set 3 V -1 10/09/20, 16:33

    > Patch Set 2: > > > Patch Set 2: > > > > > Patch Set 2: Verified-1 Code-Review-1 > > > > > > My test scenario fails > > > > > > * TYPO3 10.4.0-dev (master) > > > * active site configuration with base "http://feloginpw.master10.t3.docker/"; > > > > > > page = PAGE > > > page.1 = TEXT > > > # UID 15 is subpage within the same pagetree with page slug "/asdf" > > > page.1.typolink.parameter = 15 > > > page.1.typolink.returnLast = url > > > page.1.typolink.forceAbsoluteUrl = 1 > > > page.1.typolink.forceAbsoluteUrl.scheme = https > > > > > > results in: > > > > > > http://feloginpw.master10.t3.docker/asdf > > > > @Nikita, can you reproduce my outlined scenario? > > Hi josef, > seems this only should work for access restricted pages. > Additionaly i found this commit https://review.typo3.org/58063 > > Benni wrote there: > As for the linking process: > - typolink.forceAbsoluteUrl is used to generate the full URL to a target page > - typolink.forceAbsoluteUrl.scheme is only applicable if the site base of the target does not explicitly define a scheme > - If you link to a different page tree or to a different host/scheme, it is always treated as absolute. > > Seems like this option is not really needed with site configuration? I don't know if the person who filed that issue had old ts setup or site config. > > Besides that this patch only fixes the part, where the wrong path was beeing generated. > The "/" after the host was missing resulting in http://feloginpw.master10.t3.dockerasdf in your example. The scheme of absolute links to pages is defined by the site config and typolink.forceAbsoluteUrl.scheme is only taken into account if no scheme is set for whatever reason. I'd consider this issue resolved in v10 and master and opt for abandon this patch as this is not a priority bugfix for v9. Any objection?
  5. Daniel Goerz commented on patch set 3 V 0 10/09/20, 16:38

    On second thought, prepending the slash in the case of an access restricted page with forced scheme looks like a legit bugfix...
  6. Markus Klein voted on patch set 3 V +1 CR +1 10/10/20, 19:01

  7. TYPO3com voted on patch set 3 V +1 10/10/20, 19:22 Completed build in 14m 48s on Sat, 10 Oct, 07:22 PM Test Summary: 73740 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-6428

  8. Alexander Schnitzler commented on patch set 3 CR -1 10/30/20, 17:52

    I think this has to be solved in the PageLinkBuilder (https://github.com/TYPO3/TYPO3.CMS/blob/master/typo3/sysext/frontend/Classes/Typolink/PageLinkBuilder.php#L419). That's where changing the scheme fails because \TYPO3\CMS\Core\Routing\RouterInterface::generateUri() always falls back to http if no scheme is given.
  9. David Bruchmann commented on patch set 3 03/28/21, 21:43

    In a multi-domain setup I had to create the site-config-files without scheme, else I got errors or misbehavior. Therefore I haven't a defined scheme and the requirements for changing the scheme are not given. So decoupling the requirement by the siteconfig would be useful in my case.
  10. Benni Mack uploaded patch set 4 05/12/21, 15:24

  11. Benni Mack commented on patch set 4 V +1 CR +1 05/12/21, 15:25

    Double-checked this one. Also added the case for the non-protected links to override the scheme.
  12. core-ci voted on patch set 4 V -1 05/12/21, 15:44 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11444

  13. Nikita Hovratov commented on patch set 4 05/12/21, 15:44

    Reply

    Hey Benni, thanks for taking care! I guess the comment above needs to be changed too now in the PageLinkBuilder?
  14. Nikita Hovratov uploaded patch set 5 05/12/21, 15:58

  15. Nikita Hovratov updated the commit message in patch set 6 05/12/21, 16:03

  16. core-ci voted on patch set 5 V +1 05/12/21, 16:10 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11448

  17. core-ci voted on patch set 6 V +1 05/12/21, 16:14 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/11449

  18. Benni Mack voted on patch set 6 V +1 CR +1 05/12/21, 20:11

  19. Richard Haeser voted on patch set 6 V +2 CR +2 05/31/21, 10:46

  20. Richard Haeser merged patch set 7 05/31/21, 10:46

  21. David Bruchmann commented on patch set 7 05/31/21, 12:04

    PageLinkBuilder.php:421

    this might show unexpected behavior especially in local development environment without ssl. It looks like working with http and without scheme is not possible anymore.
  22. Richard Haeser commented on patch set 7 05/31/21, 19:16

    PageLinkBuilder.php:421 Reply

    Well, as it is an absolute URL, it should include the scheme and that is exactly what this patch is fixing. Furthermore not that much is changed isn't it? It still uses the $uri->getScheme when set when you did not specify it with forceAbsoluteUrl.scheme and the fallback is https. Or do you have a case what is not working anymore? If so, can you create a new forge issue for this and mention it in this issue? Will wait a day before merging the backport to v10.
  23. David Bruchmann commented on patch set 7 06/01/21, 06:35

    PageLinkBuilder.php:421 Reply

    I had an edge case that wouldn't work probably but there is SSL used. I never verify it in detail as I never have the time for it. SSL is required anyway on live-sites now and should be applied on dev-sites too. So feel free to commit / merge.
  24. David Bruchmann commented on patch set 7 07/12/21, 05:51

    PageLinkBuilder.php:421 Reply

    My problems concerning the mentioned problems concern the backend which can't be solved by the frontend-extension. So actually I'd something similar for the backend.
  25. Nikita Hovratov commented on patch set 7 11/22/23, 21:49

    PageLinkBuilder.php:421 Reply

    I mark this as done. If there are any problems concerning this patch, please create an issue on forge.