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

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

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Neutral
    • Resolution: Duplicate
    • Affects Version/s: 5.3.8
    • Fix Version/s: None
    • Component/s: None
    • Labels:
    • Story Points:
      8

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

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