Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-23448

Cross Siteaccess links not working properly

    Details

      Description

      Currently if you try to generate a cross siteaccess link the path of the target siteaccess isn't cut off from the generated Url.

      This is caused because rootLocationId in here https://github.com/ezsystems/ezpublish-kernel/blob/master/eZ/Publish/Core/MVC/Symfony/Routing/Generator/UrlAliasGenerator.php#L109 is set to the current siteaccess's locationId.

      Therefore the wrong path prefix is generated.

      Somehow rootLocationId in this context should be set for the specified target siteaccess and not used from here https://github.com/ezsystems/ezpublish-kernel/blob/master/eZ/Bundle/EzPublishCoreBundle/EventListener/RoutingListener.php#L57

      See my dirty hack (don't fix it this way): https://gist.github.com/bennyklotz/85747cd3b08ab963580e

        Issue Links

          Activity

          Hide
          Jérôme Vieilledent (Inactive) added a comment -

          OK thanks. I'll close it then.

          Show
          Jérôme Vieilledent (Inactive) added a comment - OK thanks. I'll close it then.
          Hide
          Miguel das Neves Jacinto (Inactive) added a comment -

          [~jerome.vieilledent@ez.no] I think this issue has already been fixed, see EZP-24399

          Show
          Miguel das Neves Jacinto (Inactive) added a comment - [~jerome.vieilledent@ez.no] I think this issue has already been fixed, see EZP-24399
          Hide
          Jérôme Vieilledent (Inactive) added a comment -

          QA: Can you please test this issue, at in master/5.4/5.3? Maybe there is a missing backport somewhere?

          Thanks

          Show
          Jérôme Vieilledent (Inactive) added a comment - QA: Can you please test this issue, at in master/5.4/5.3? Maybe there is a missing backport somewhere? Thanks
          Hide
          Jérôme Vieilledent (Inactive) added a comment -

          Hi

          I cannot reproduce this issue, generated links seem to be perfectly OK.
          Here's my setup:

          ezpublish.yml

          • 2 Siteaccesses (ezdemo_site and eng)
          • Default siteaccess: eng
          • ezdemo_site is configured with a tree root (see following yaml from my ezpublish.yml)

          ezpublish:
              siteaccess:
                  default_siteaccess: eng
                  list:
                      - ezdemo_site
                      - eng
                      - ezdemo_site_admin
                  groups:
                      ezdemo_site_group:
                          - ezdemo_site
                          - eng
                          - ezdemo_site_admin
                  match:
                      URIElement: '1'
              system:
                  ezdemo_site_group:
                      repository: eng_repository
                      var_dir: var/ezdemo_site
                  eng:
                      languages:
                          - eng-GB
                      session:
                          name: eZSESSID
           
                  ezdemo_site:
                      languages:
                          - eng-GB
                          - fre-FR
                      session:
                          name: eZSESSID
                      content:
                          tree_root:
                              location_id: 61
           
                  ezdemo_site_admin:
                      languages:
                          - eng-GB
                          - fre-FR
          

          Adding cross-siteaccess links

          I modified page_header.html.twig from DemoBundle, for a quick reproduction, to add the following code:

          <ul>
              <li><a href="{{ path("ez_urlalias", {"locationId": 73, "siteaccess": 'ezdemo_site'}) }}">Foo ezdemo_site</a></li>
              <li><a href="{{ path("ez_urlalias", {"locationId": 73, "siteaccess": 'eng'}) }}">Foo eng</a></li>
          </ul>
          

          This generates following links:

          <ul>
              <li><a href="/ezdemo_site/Selected-Features/Getting-Started-with-eZ-Publish-Platform">Foo ezdemo_site</a></li>
              <li><a href="/eng/Getting-Started/Selected-Features/Getting-Started-with-eZ-Publish-Platform">Foo eng</a></li>
          </ul>
          

          Generated links are perfectly valid to me. ezdemo_site is indeed configured to begin under Getting-Started (location #61).

          Show
          Jérôme Vieilledent (Inactive) added a comment - Hi I cannot reproduce this issue, generated links seem to be perfectly OK. Here's my setup: ezpublish.yml 2 Siteaccesses ( ezdemo_site and eng ) Default siteaccess: eng ezdemo_site is configured with a tree root (see following yaml from my ezpublish.yml) ezpublish: siteaccess: default_siteaccess: eng list: - ezdemo_site - eng - ezdemo_site_admin groups: ezdemo_site_group: - ezdemo_site - eng - ezdemo_site_admin match: URIElement: '1' system: ezdemo_site_group: repository: eng_repository var_dir: var/ezdemo_site eng: languages: - eng-GB session: name: eZSESSID   ezdemo_site: languages: - eng-GB - fre-FR session: name: eZSESSID content: tree_root: location_id: 61   ezdemo_site_admin: languages: - eng-GB - fre-FR Adding cross-siteaccess links I modified page_header.html.twig from DemoBundle, for a quick reproduction, to add the following code: <ul> <li><a href="{{ path("ez_urlalias", {"locationId": 73, "siteaccess": 'ezdemo_site'}) }}">Foo ezdemo_site</a></li> <li><a href="{{ path("ez_urlalias", {"locationId": 73, "siteaccess": 'eng'}) }}">Foo eng</a></li> </ul> This generates following links: <ul> <li><a href="/ezdemo_site/Selected-Features/Getting-Started-with-eZ-Publish-Platform">Foo ezdemo_site</a></li> <li><a href="/eng/Getting-Started/Selected-Features/Getting-Started-with-eZ-Publish-Platform">Foo eng</a></li> </ul> Generated links are perfectly valid to me. ezdemo_site is indeed configured to begin under Getting-Started (location #61).
          Hide
          Benjamin Klotz added a comment -

          I'm no longer a php dev and also no longer working for the company where we had projects which was affected by this.
          The proper gist url is: https://gist.github.com/tak1n/85747cd3b08ab963580e

          Basically the problem was that the rootLocationId always stayed the same regardless of the siteaccess.
          Therefore the link base always was the root siteaccess even for links to other siteaccesses -> generated wrong path (/path/to/siteaccess/my/blog/post instead of /myblog/post)

          Sorry I cannot provide any more reproduction (no access to the git repos of my old company)

          Show
          Benjamin Klotz added a comment - I'm no longer a php dev and also no longer working for the company where we had projects which was affected by this. The proper gist url is: https://gist.github.com/tak1n/85747cd3b08ab963580e Basically the problem was that the rootLocationId always stayed the same regardless of the siteaccess. Therefore the link base always was the root siteaccess even for links to other siteaccesses -> generated wrong path (/path/to/siteaccess/my/blog/post instead of /myblog/post) Sorry I cannot provide any more reproduction (no access to the git repos of my old company)
          Hide
          Jérôme Vieilledent (Inactive) added a comment -

          Benjamin Klotz Can you please provide clear steps to reproduce?

          Thanks

          Show
          Jérôme Vieilledent (Inactive) added a comment - Benjamin Klotz Can you please provide clear steps to reproduce? Thanks

            People

            • Assignee:
              Unassigned
              Reporter:
              Benjamin Klotz
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: