When indenting the Confluence XHTML code in a specific way, a space is added to some parameter values under specific conditions. Given this situation:
- A first macro m1 contains an ac:parameter tag contains whitespace(s) at its end
- m1 is immediately followed by a macro that has an ac:parameter tag
m1's parameter will end with a space. If m1 is not followed by a macro, of if this macro doesn't have an ac:parameter tag, the space is not there. Reproduction case:
<object class="BodyContent" package="com.atlassian.confluence.core">
<id name="id">156868656</id>
<property name="body"><![CDATA[
<p><ac:structured-macro ac:name="randommacro"><ac:parameter ac:name="randombuggyparam">A </ac:parameter></ac:structured-macro><ac:structured-macro ac:name="anotherrandommacroneededtoreproduce"><ac:parameter ac:name="randomparamneededtoreproduce">v</ac:parameter></ac:structured-macro></p>
<p><ac:structured-macro ac:name="randommacro"><ac:parameter ac:name="randombuggyparam">A </ac:parameter></ac:structured-macro></p>
<p><ac:structured-macro ac:name="randommacro"><ac:parameter ac:name="spaceKey"><ri:space ri:space-key="A" /> </ac:parameter></ac:structured-macro><ac:structured-macro ac:name="anotherrandommacroneededtoreproduce"><ac:parameter ac:name="randomparamneededtoreproduce">v</ac:parameter></ac:structured-macro></p>
<p><ac:structured-macro ac:name="randommacro"><ac:parameter ac:name="spaceKey"><ri:space ri:space-key="A" /> </ac:parameter></ac:structured-macro></p>
]]></property>
<property name="content" class="Page" package="com.atlassian.confluence.pages"><id name="id">45809845</id></property>
<property name="bodyType">2</property>
</object>
Actual:
{{randommacro randombuggyparam="A "/}}{{anotherrandommacroneededtoreproduce randomparamneededtoreproduce="v"/}}
{{randommacro randombuggyparam="A"/}}
{{randommacro spaceKey="A "/}}{{anotherrandommacroneededtoreproduce randomparamneededtoreproduce="v"/}}
{{randommacro spaceKey="A"/}}
Expected:
{{randommacro randombuggyparam="A"/}}{{anotherrandommacroneededtoreproduce randomparamneededtoreproduce="v"/}}
{{randommacro randombuggyparam="A"/}}
{{randommacro spaceKey="A"/}}{{anotherrandommacroneededtoreproduce randomparamneededtoreproduce="v"/}}
{{randommacro spaceKey="A"/}}
We have not seen Confluence generate such an input, which makes the bug minor, but this is still a bit concerning. |