Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-76828

Layout Import does not replace @ variables in URLs correctly

    Details

      Description

      Reproduction steps:

      1. create a site named "testsite"
      2. add a page named "page1"
      3. add a basic web content to "page1" with two links to "page1": "http://localhost:8080/web/testsite/page1"
      4. export with Side Menu --> Publishing --> Export
      5. re-import into the same site
      6. check the second link in the re-imported web content:
      "http://localhost:8080@data_handler_public_servlet_mapping/testsite@/page1"

      This is how the links will look like:

      • original: "http://localhost:8080/web/testsite/page1"
      • export file: "@data_handler_company_url@@data_handler_public_servlet_mapping@@data_handler_group_friendly_url@@/testsite@/page1"
      • re-import: "http://localhost:8080@data_handler_public_servlet_mapping/testsite@/page1"

      The import replacement works only for the first link.
      content.indexOf(group.getFriendlyURL()) searches always from the start of content, and replaces the first "@/testsite@" string, which accidentally happens to be valid, because "@data_handler_group_friendly_url@" is also replaced by "/testsite" and it creates a "@/testsite@" string, since it's surrounded by not-yet replaced @@ constants. That's why the replacement should start at groupFriendlyUrlPos.

      Example replacement:
      1. href="http://localhost:8080@data_handler_public_servlet_mapping@@data_handler_group_friendly_url@@/testsite@/page1"
      2. href="http://localhost:8080@data_handler_public_servlet_mapping@/testsite@/testsite@/page1"
      3. href="http://localhost:8080@data_handler_public_servlet_mapping/testsite@/page1"

      The result is that "@data_handler_public_servlet_mapping@" loses its trailing "@", so it does not get replaced at the end of the method. And we will see links like this in the imported content: http://localhost:8080@data_handler_public_servlet_mapping/guest@/seite2

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              yvonne.han Yvonne Han
              Reporter:
              vendel.toreki Vendel Töreki
              Participants of an Issue:
              Recent user:
              Brian Wulbern
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Days since last comment:
                2 years, 41 weeks, 2 days ago

                  Packages

                  Version Package
                  7.0.0 DXP FP40
                  7.0.0 DXP SP7
                  7.0.5 CE GA6
                  7.0.X
                  7.1.0 M1
                  7.1.X
                  Master