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

BaseTextExportImportProcessor.validateLayoutReferences method does not take into account the possibility of friendly URLs for portlets

    Details

      Description

      Description
      The BaseTextExportImportProcessor.validateLayoutReferences method fails to take into account that a URL might involve a friendly URL to a portlet (see https://dev.liferay.com/develop/tutorials/-/knowledge_base/6-1/adding-friendly-url-mapping-to-the-portlet).

      If you try to publish a web content article with a link consisting of a friendly URL to a portlet, the BaseTextExportImportProcessor.validateLayoutReferences method will parse the URL incorrectly, and ultimately, a NoSuchLayoutException will be thrown, preventing the article from being added.

      Steps to Reproduce

      1. Start up Liferay on a fresh database and log in as the admin user.
      2. Navigate to Liferay > Content > Web Content > + (Add Button) > Basic Web Content.
      3. Give it a title (it doesn't matter what the title is).
      4. Switch the "Content" field to Code view.
      5. Paste the following HTML into the "Content" field:
        <p><span><a href="http://localhost:8080/web/guest/home/-/testportlet">text</a></span></p>
        

        Note: Although we have not created a portlet with the friendly URL testportlet, this doesn't matter. The validator is only supposed to validate the URL to the page; it should not validate whether or not the full URL points to an existing portlet

      6. Click on the Submit button

      Expected result: The web content article is successfully added with no errors.
      Actual result: An error appears in the UI: "The content references a missing page." The web content article is not added.

      Reproduced in
      master (3bec09301a5e7610b1ddfade873c18e38e8c2637)
      ee-7.0.x (c4abd9aafb206ad0676927c27fb4acbe99f1ddb9)

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  2 years, 26 weeks, 6 days ago

                  Packages

                  Version Package
                  7.0.0 DXP FP14
                  7.0.0 DXP SP3
                  7.0.3 CE GA4
                  7.0.X EE
                  7.1.X
                  Master