Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-8855

Page is not available via full JCR path if handlePrefix has more than 1 level

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Neutral
    • None
    • 6.2.30
    • None
    • None

    Description

      Issue description

      Following page 
      https://demoauthor.magnolia-cms.com/.magnolia/admincentral#app:pages-app:browser;/travel/about/company::

      is reachable via the following 2 URLs with the handlePrefix set to /travel
      https://travel-demo.magnolia-cms.com/about/company
      https://travel-demo.magnolia-cms.com/travel/about/company

      If the handlePrefix is changed to /travel/about, the second URL with the full path to the node returns a 404, as the handlePrefix is added to the URL.

      Link to the handlePrefix
      https://demoauthor.magnolia-cms.com/.magnolia/admincentral#app:site:browser;/travel/mappings/website@handlePrefix:null:

      handlePrefix with /travel/about

      Works:[ https://travel-demo.magnolia-cms.com/company|https://travel-demo.magnolia-cms.com/company]
      Error: https://travel-demo.magnolia-cms.com/travel/about/company

      The problem is in info.magnolia.cms.beans.config.URI2RepositoryMapping#getHandle, as only the part before the first "/" is compared with the handlePrefix and the following removal of the handlePrefix isn't done.

      Expected results

      The page can be accessed through the full path https://travel-demo.magnolia-cms.com/travel/about/company

      Actual results

      404 error is shown at browser

      Workaround

      Modify the getHandle() method within the URI2RepositoryMapping class to get the handle before first slash as follows:

      URI2RepositoryMapping#getHandle()
      [...]
      if (StringUtils.startswith(cleanedUri, StringUtils.prependIfMissing(handlePrefix, "/"))) { 
             // We remove any occurrences of the handle prefix from given URI        
            cleanedUri = StringUtils.removeStart(cleanedUri, handlePrefix);
      }
      

      Development notes

      N/A

      Checklists

        Acceptance criteria

        Attachments

          Issue Links

            Activity

              People

                oanh.thai Oanh Thai Hoang
                ccantalapiedra Carlos Cantalapiedra
                DeveloperX
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:
                  Work Started:

                  Checklists

                    Bug DoR
                    Task DoD