[MGNLDAM-494] DamTemplatingFunctions#getAssetForAbsolutePath throws an IllegalArgumentException when JcrAssetProvider is used and rootPath is set to "/" Created: 29/Jul/14  Updated: 06/Aug/14  Resolved: 29/Jul/14

Status: Closed
Project: Magnolia DAM Module
Component/s: None
Affects Version/s: None
Fix Version/s: 2.0.2

Type: Bug Priority: Major
Reporter: Milan Divilek Assignee: Milan Divilek
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
relation
is related to MGNLDAM-481 JcrAssetProvider#getRootFolder throws... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled

 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.


Generated at Mon Feb 12 05:00:24 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.