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

Remove legacy code that allows to access site with duplicate prefix in the url

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Neutral Neutral
    • 5.4.11, 5.5.1
    • 5.4, 5.5
    • None
    • Kromeriz 74
    • 3

      Can be seen on the travel demo project: https://demopublic.magnolia-cms.com/travel/travel
      This can be reproduced only by manually accessing such URL or by creating such a link deliberately.

      handle = cleanHandle(handle);
      
      try {
          final Session session = MgnlContext.getJCRSession(this.repository);
          if (!session.itemExists(handle)) {
              String maybeHandle = (this.handlePrefix.endsWith("/") ? "/" : "") + StringUtils.removeStart(handle, this.handlePrefix);
              // prefix might have been prepended incorrectly. Second part of the condition is there to match links to binary nodes
              if (session.itemExists(maybeHandle) || (maybeHandle.lastIndexOf("/") > 0 && session.itemExists(StringUtils.substringBeforeLast(maybeHandle, "/")))) {
                  return maybeHandle;
              }
          }
      } catch (RepositoryException e) {
          //Log the exception and return handle
          log.debug(e.getMessage(), e);
      }
      return handle;
      

      This code causes that the first /travel is cleared from the url and the result of that is that page that does not exist under path /travel/travel is served.

        Acceptance criteria

              jsimak Jaroslav Simak
              ochytil Ondrej Chytil
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Bug DoR
                  Task DoD