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

Inconsistency in handling portletId for portlet names containing dashes

    Details

      Description

      When retrieving a portlet from the portlet pool, Liferay strips the JS-unsafe characters from the name before attempting to lookup the portlet from the portlet pool.

      https://github.com/liferay/liferay-portal/blob/7.0.2-ga3/portal-impl/src/com/liferay/portal/service/impl/PortletLocalServiceImpl.java#L486-L503

      However, for an OSGi portlet, Liferay does not strip the JS-unsafe characters before storing it to the portlet pool.

      https://github.com/liferay/liferay-portal/blob/7.0.2-ga3/modules/apps/static/portal-osgi-web/portal-osgi-web-portlet-tracker/src/main/java/com/liferay/portal/osgi/web/portlet/tracker/internal/PortletTracker.java#L125-L126
      https://github.com/liferay/liferay-portal/blob/7.0.2-ga3/modules/apps/static/portal-osgi-web/portal-osgi-web-portlet-tracker/src/main/java/com/liferay/portal/osgi/web/portlet/tracker/internal/PortletTracker.java#L327
      https://github.com/liferay/liferay-portal/blob/7.0.2-ga3/modules/apps/static/portal-osgi-web/portal-osgi-web-portlet-tracker/src/main/java/com/liferay/portal/osgi/web/portlet/tracker/internal/PortletTracker.java#L977-L978
      https://github.com/liferay/liferay-portal/blob/7.0.2-ga3/portal-impl/src/com/liferay/portal/service/impl/PortletLocalServiceImpl.java#L302

      This behavior is inconsistent and results in Liferay not recognizing that a portlet is available when it is deployed. We need to either disallow JS-unsafe characters prior to registering the portlet (similar to what we do when the portlet name is too long) or we need to strip the JS-unsafe characters when generating the portlet ID.

      As such, Portlets with dashes in the name default to `undeployed` and are unable to be added to sites.

      Steps to Reproduce:
      1. Start up a clean Liferay DXP bundle.
      2. Deploy the attached test portlet: com.liferay.training.hello.portlet.jar
      3. Navigate to the App Manager and search for 'hello' to verify that the portlet has deployed successfully.
      4. Attempt to add the portlet to a page.

      Expected: Portlet deploys successfully and is available to add to pages.
      Actual: Portlet deploys successfully, but is not available to add to pages.

      Additional Testing:
      7.0.x: 3e49837722aee7b9706ced5dea813b9092e8a6e3
      Issue reproduced in branch.

      Master: 473382f24854e2cf99ff6fa657cbb1c26af02c40
      Issue reproduced in master.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

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

                  Packages

                  Version Package
                  7.0.0 DXP FP9
                  7.0.0 DXP SP2
                  7.0.3 CE GA4
                  7.1.X
                  Master