Uploaded image for project: 'Magnolia DAM Module'
  1. Magnolia DAM Module
  2. MGNLDAM-494

DamTemplatingFunctions#getAssetForAbsolutePath throws an IllegalArgumentException when JcrAssetProvider is used and rootPath is set to "/"

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 2.0.2
    • None
    • None
    • None

    Description

      DamTemplatingFunctions#getAssetForAbsolutePath throws an IllegalArgumentException ("relPath is not a relative path:") when info.magnolia.dam.jcr.JcrAssetProvider is used an rootPath is set to "/"

      Problematic code is

      info.magnolia.dam.templating.functions.DamTemplatingFunctions#getAssetForAbsolutePath
      String relativeAssetPath = StringUtils.removeStart(absoluteAssetPath, provider.getRootFolder().getPath() + "/");
      

      Because info.magnolia.dam.jcr.JcrAssetProvider#getPath returns "/" in case when provider root path is set to "/" and then starting "/" is not stripped from absoluteAssetPath.

      Checklists

        Acceptance criteria

        Attachments

          Issue Links

            Activity

              People

                mdivilek Milan Divilek
                mdivilek Milan Divilek
                Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:

                  Checklists

                    Bug DoR
                    Task DoD