after confluence upgrade to 7.7 User Macro output is not proper format

Basudev Behera {Appfire} February 9, 2022

We have a couple of macros to show SQL query where one of the sample code is as below

--------------------------------------

## @Param ReportTitle:title=Report Title|type=string|required=false
#set($paramReportTitle="Resource Planning Report - " + $content.currentDate)
#set($doubleQuote = '"' )

#set($sqlQuery = "SELECT id AS ${doubleQuote}JI ID${doubleQuote} FROM jiraissue LIMIT 1;")

$sqlQuery
---------------------------------------

It was working fine till the confluence 7.6 version but after 7.7 the output got changed

Below is the result with confluence 7.6-

9371-Confluence-7.6.3.png

Below is the result with confluence 7.7-

9371-Confluence-7.7.2.png

We expect native behavior of confluence where '"' should be in the output in the query instead of '&quot' in 7.7 version of the confluence.

Please suggest a solution or workaround to get proper output with confluence 7.7. 

1 answer

1 vote
Anuj Sharma
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 10, 2022

As per https://community.atlassian.com/t5/Confluence-questions/User-macro-fails-after-update-from-7-4-to-7-13/qaq-p/1857468 , For Confluence 7.7 and above, it seems Confluence performs htmlencoding for every variable that is used as output, except the name of the variable ends with "Html". So in the discussed case here, name the variable "includelineHtml" instead of "includeline". That should work then"

 So in the case of your User macro, you have to add html at the end of doubleQuote variable. 

  USE THIS

## @noparams
## @Param ReportTitle:title=report-title|type=string|required=false
#set($paramReportTitle="resource-planning-report-" + $content.currentDate)
#set($doubleQuoteHtml = '"' )
#set($sqlQuery = "SELECT id AS ${doubleQuoteHtml}JI ID${doubleQuoteHtml} FROM jiraissue LIMIT 1;")
$sqlQuery

Instead of 

@Param ReportTitle:title=Report Title|type=string|required=false
#set($paramReportTitle="Resource Planning Report - " + $content.currentDate)
#set($doubleQuote = '"' )
#set($sqlQuery = "SELECT id AS ${doubleQuote}JI ID${doubleQuote} FROM jiraissue LIMIT 1;")$sqlQuery

I tested this in my local instance running 7.7.2 and it works


Regards,
Anuj Sharma

Bill Bailey
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 Leaders.
February 10, 2022

Could you point us and other user macro enthusiast to where this is documented, please?

Suggest an answer

Log in or Sign up to answer