Details
-
Bug
-
Resolution: Fixed
-
High
-
None
-
None
-
None
-
-
Empty show more show less
-
DevX 39
-
2
-
Yes
Description
When editor use CKeditor (richtextfield) and use build-in functionality for internal link - a.k.a. paragraph in richtextfield contains link to another internal page.
e.g content of the richtextfield (content.desc):
<p>Some text with link <a href="${link:{uuid:{d17e1eba-ea6c-4b65-afd5-43fb28633eb5},repository:{website},path:{/international-programmes}}}">International Busines offering</a></p>
But if this page doest exists:
- was deleted
- is not published
- another editor doesn't have the right to see such page.
Then rendering this data in template using
${cmsfn.decode(content).desc)
Fails!
this is possible partially workaround by
[#attempt]
${cmsfn.decode(content).desc}
[#recover]
// print something else
[/#attempt]
But this is still not ideal, because it will not render whole paragraph (whole content of richtextfiled)
Expected: Paragraph will be rendered and only link would not have a link <a href>
But there is second part in case we need to check if content exist first, code like this:
[#if content.title?has_content || content.desc?has_content] <section class="ArticleSection"> [#if content.title?has_content] <h2 class="ArticleSection--title">${content.title!}</h2> [/#if] [#attempt] <div class="richtext"> [#if content.desc?has_content] ${cmsfn.decode(content).desc} [/#if] </div> [#recover] // print something else [/#attempt] </section> [/#if]
This will already fail on line #1 :
Error while rendering [/...] with template [...:components/basicContent2] for URI [/...]: RenderException: freemarker.core._MiscTemplateException: Expression has thrown an unchecked exception; see the cause exception. The blamed expression: ==> content.desc [in template ".../templates/components/basicContent.ftl" at line 37, column 35] ---- FTL stack trace ("~" means nesting-related): - Failed at: #if content.title?has_content || cont... [in template ".../templates/components/basicContent.ftl" at line 37, column 1] ---- info.magnolia.rendering.engine.RenderException: freemarker.core._MiscTemplateException: Expression has thrown an unchecked exception; see the cause exception. The blamed expression: ==> content.desc [in template "..../templates/components/basicContent.ftl" at line 37, column 35]
Expected: content.desc?has_content will return true or fals no matter if it contains link which doesn't exists or not.
Thank you
Developer notes:
see attached stack-trace.txt:
Caused by: java.lang.NullPointerException
at info.magnolia.multisite.CrossSiteAbsolutePathTransformer.prefixLink(CrossSiteAbsolutePathTransformer.java:67) ~[magnolia-module-multisite-2.1.2.jar:?]
Checklists
Attachments
Issue Links
- relates to
-
MAGNOLIA-8936 Link to deleted Page leads to Template-Exception
-
- Closed
-
1.
|
implement Fix |
|
Completed | Milan Divilek | ||||||||
2.
|
review |
|
Completed | Robert Šiška | ||||||||
3.
|
preintQA |
|
Completed | Robert Šiška | ||||||||
4.
|
QA |
|
Completed | Oanh Thai Hoang |
|