XHTML stored in macro with CDATA causes XMLStreamException

XMLWordPrintable

    • Type: Bug
    • Resolution: Not a bug
    • Priority: Low
    • None
    • Affects Version/s: 8.0.2
    • Component/s: Core - Macros Platform
    • None
    • Severity 3 - Minor

      Issue Summary

      This is reproducible on Data Center: yes

      Confluence throws error when storage format input to html-bobswift macro has CDATA section.

      Steps to Reproduce

      1. Install HTML for Confluence (https://marketplace.atlassian.com/apps/252/html-for-confluence?hosting=datacenter&tab=overview)
      2. Create a page in Confluence
      3. Add html-bobswift macro with contents
        <ac:link><ri:page ri:content-title="Home" /><ac:plain-text-link-body><![CDATA[home link]]></ac:plain-text-link-body></ac:link> 
      1. Check preview works
      2. Publish the page

      Expected Results

      Page save as expected.

      Actual Results

      There is an error pop-up saving the page.

      The below exception is thrown in the atlassian-confluence.log file:

      2023-01-05 10:44:13,223 WARN [http-nio-1990-exec-10] [confluence.tinymceplugin.rest.DraftsResource] save The supplied editor content could not be converted to  storage format.
       -- url: /confluence/rest/tinymce/1/drafts | userName: admin | referer: http://confluence.mycompany.com/confluence/pages/resumedraft.action?draftId=393237&draftShareId=
      eea5b220-27d9-4aa7-9635-da473ddd44e1& | traceId: c051421c9b41e195
      com.atlassian.confluence.content.render.xhtml.XhtmlException: RuntimeException occurred while transforming editor format to storage format (Unexpected exception writing to stringwriter. java.io.IOException: javax.xml.stream.XMLStreamException: Illegal input: CDATA block has embedded ]]> in it (index 87))
              at com.atlassian.confluence.content.render.xhtml.editor.EditorXhtmlTransformer.transform(EditorXhtmlTransformer.java:58)
              at com.atlassian.confluence.content.render.xhtml.TransformerChain.transform(TransformerChain.java:33)
              at com.atlassian.confluence.content.render.xhtml.TransformerChain.transform(TransformerChain.java:33)
              at com.atlassian.confluence.content.render.xhtml.PluggableTransformerChain.transform(PluggableTransformerChain.java:39)
              at com.atlassian.confluence.content.render.xhtml.editor.DefaultEditorConverter.convert(DefaultEditorConverter.java:37)
       

      Workaround

      We don't recommend nested CDATA sections. Instead use

      <ac:link><ri:page ri:content-title=“Home” /><ac:plain-text-link-body>home link</ac:plain-text-link-body></ac:link> 

            Assignee:
            Marcus Si
            Reporter:
            James Richards
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: