The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

user macro failes

Sara von Hofsten
February 26, 2024

 

 

Hello,

this user macro, that I posted a picture of below, suddenly stopped working and is only displaying  $htmlUtil.htmlEncode($content.displayTitle)

I can't seem to fix it. I think this happend after the last patch of Confluence to version 8.5.4.

How can I fix it? We use this macro a lot in our organization.

 

Skärmbild 2024-02-26 132938.png

 

 

 

 

 

 

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Andrii Maliuta
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
February 26, 2024

Hello @Sara von Hofsten ,

I can see that HtmlUtil should be available in velocity context according to the docs: https://developer.atlassian.com/server/confluence/confluence-objects-accessible-from-velocity, but really, it is not.

As an option, if HTML is rendered with a variable assignment, the variable name needs to end with "Html". This will render HTML instead of escaping it.

Example: $outputHtml instead of $output

So you can try to create the variable with the title ending with 'html' to be escaped, like:

#set($titleHtml = $content.displayTitle )
$content.displayTitle ## as is
<br>
$titleHtml ## escaped
<br>

https://confluence.atlassian.com/doc/user-macro-template-syntax-223906130.html

 

Sara von Hofsten
February 27, 2024

adding HtmlUtil to string in setenv.sh fixed the html problem.

The macro output looks correct but there's some problem with the lik to parent page. I get page not found or insufficient permission error, but i guess it's a macro problem and not a server problem :)

Like Andrii Maliuta likes this
DEPLOYMENT TYPE
SERVER
VERSION
8.5.4
TAGS
AUG Leaders

Atlassian Community Events