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

Checking to see if prefix might have been prepended incorrectly is no longer needed

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Duplicate
    • Icon: Neutral Neutral
    • None
    • 5.3.8
    • None
    • 8

      MGNLDMS-188 introduced a fallback mechanism for the DMS to check if the handle prefix had been prerended incorrectly if the request came using the complete path to the item.

      Snippet from URI2RepositoryMapping getHandle() method:

      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;
                      }
                  }
      

      This creates a situation where an item in the dms could have 2 potential request URLs, which is bad for SEO. Plus the dms doesn't exist in Magnolia 5 anyway. The new DAM has its own version of the mapping class DamURI2RepositoryMapping. This class doesn't even consider a configured handlePrefix in the method getHandle(). So for these reasons we should remove this this erroneous code from Magnolia 5.

        Acceptance criteria

              Unassigned Unassigned
              rgange Richard Gange
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Task DoD