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

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

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Neutral
    • Resolution: Fixed
    • Affects Version/s: 5.4, 5.5
    • Fix Version/s: 5.4.11, 5.5.1
    • Component/s: None
    • Labels:
    • Sprint:
      Kromeriz 74
    • Story Points:
      3
    • Magnolia Release:
      5.4.11, 5.5.1

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Date of First Response: