This issue has been created
 
 
Confluence / cid:jira-generated-image-avatar-a46bc515-11e1-4e4c-8410-a74f2c180b64 CONFLUENCE-262 Open

Weird trailing whitespace in macro parameter values in some conditions

 
View issue   ·   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-386506ed-9550-4823-b21b-550805cfc924 Raphaël Jakse created this issue on 22/Aug/24 09:23
 
Summary: Weird trailing whitespace in macro parameter values in some conditions
Issue Type: cid:jira-generated-image-avatar-a46bc515-11e1-4e4c-8410-a74f2c180b64 Bug
Affects Versions: 9.50.2
Assignee: Unassigned
Components: Syntax - XHTML
Created: 22/Aug/24 09:23
Priority: cid:jira-generated-image-static-minor-e16f2895-6a01-4383-8542-c1618e28e23e Minor
Reporter: Raphaël Jakse
Description:

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.