Details
-
Bug
-
Resolution: Fixed
-
Neutral
-
2.8.4
-
None
-
-
Yes
-
Empty show more show less
-
Basel 73
-
2
Description
DownloadLinkModel doesn't check if it actually receives a valid asset from DAMTemplatingFuncitons. If the asset doesn't exist, it wraps null inside a LegacyAssetWrapper, therefore the template produces an exception while accessing methods on the legacy wrapper.
Possible fix in DownloadLinkModel (check asset before returning wrapper):
public Asset getAsset() {
final String assetIdentifier = PropertyUtil.getString(this.content, "link");
if (StringUtils.isNotBlank(assetIdentifier) && null != this.damTemplatingFunctions.getAsset(assetIdentifier)) {
return new LegacyAssetWrapper(this.damTemplatingFunctions.getAsset(assetIdentifier));
}
return null;
}
The template will then show the "link does not exists" error message as before (in Magnolia 4.5).
Related to MGNLSTK-1434 which would also be fixed with this.
Cheers
Andreas
Checklists
Acceptance criteria
Attachments
Issue Links
- relates to
-
MGNLSTK-1434 DownloadLink throws TemplateModelException when a folder is selected
-
- Closed
-