Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-63523

Office Macros in Confluence don't render document preview if the macro is formatted as bold

      Issue Summary

      If the attachment is displayed via Office macro and the macro is formatted as bold, the macro won't render and the UI will show only a spinning wheel as if it were loading.

      Steps to Reproduce

      1. Edit a page with an attached Office file (xls/xlsx, doc/docx etc.)
      2. Insert an Office macro according to the attached document (for example, Office Excel Macro)
      3. Select the Excel Macro and select bold from the text format panel
        This will add <strong> tag around the macro
      4. Save the page

      Expected Results

      Office macro to render the attachments without issues.

      Actual Results

      Office macro can't render the attachments and a javascript error is thrown in the console log:

      Failed to run init function: Unexpected token < in JSON at position 0 ƒ (a){a("div.converter-macro-ajax-container").each(function(){var b=a(this),c=a.parseJSON(e.unescape(b.find(".converter-macro-parameters")[0].innerHTML));b.find(".converter-macro-file-name").text(c.nam… SyntaxError: Unexpected token < in JSON at position 0
          at JSON.parse (<anonymous>)
          at Function.E.parseJSON (batch.js?locale=en-GB:64)
          at Function.u.parseJSON (batch.js?locale=en-GB:285)
          at HTMLDivElement.<anonymous> (com.atlassian.confluence.extra.officeconnector:converter-macro-web-resources.js?locale=en-GB:5)
          at Function.each (batch.js?locale=en-GB:33)
          at u.fn.init.each (batch.js?locale=en-GB:29)
          at com.atlassian.confluence.extra.officeconnector:converter-macro-web-resources.js?locale=en-GB:5
          at batch.js?locale=en-GB:2336 SyntaxError: Unexpected token < in JSON at position 0
          at JSON.parse (<anonymous>)
          at Function.E.parseJSON (http://localhost:27112/c7112/s/f59f3d0ebd727f8430927257d7c31d35-CDN/ce33zg/8701/9e64ae2e14b2a9149d6e55bc661fa83d63f4f188/4a7ee1c57b03455f1f74ef6c18d827e5/_/download/contextbatch/js/_super/batch.js?locale=en-GB:64:24782)
          at Function.u.parseJSON (http://localhost:27112/c7112/s/f59f3d0ebd727f8430927257d7c31d35-CDN/ce33zg/8701/9e64ae2e14b2a9149d6e55bc661fa83d63f4f188/4a7ee1c57b03455f1f74ef6c18d827e5/_/download/contextbatch/js/_super/batch.js?locale=en-GB:285:3752)
          at HTMLDivElement.<anonymous> (http://localhost:27112/c7112/s/48fb512fdd6805e502f383535de1a411-CDN/ce33zg/8701/9e64ae2e14b2a9149d6e55bc661fa83d63f4f188/11.4.3/_/download/batch/com.atlassian.confluence.extra.officeconnector:converter-macro-web-resources/com.atlassian.confluence.extra.officeconnector:converter-macro-web-resources.js?locale=en-GB:5:251)
          at Function.each (http://localhost:27112/c7112/s/f59f3d0ebd727f8430927257d7c31d35-CDN/ce33zg/8701/9e64ae2e14b2a9149d6e55bc661fa83d63f4f188/4a7ee1c57b03455f1f74ef6c18d827e5/_/download/contextbatch/js/_super/batch.js?locale=en-GB:33:1304)
          at u.fn.init.each (http://localhost:27112/c7112/s/f59f3d0ebd727f8430927257d7c31d35-CDN/ce33zg/8701/9e64ae2e14b2a9149d6e55bc661fa83d63f4f188/4a7ee1c57b03455f1f74ef6c18d827e5/_/download/contextbatch/js/_super/batch.js?locale=en-GB:29:998)
          at http://localhost:27112/c7112/s/48fb512fdd6805e502f383535de1a411-CDN/ce33zg/8701/9e64ae2e14b2a9149d6e55bc661fa83d63f4f188/11.4.3/_/download/batch/com.atlassian.confluence.extra.officeconnector:converter-macro-web-resources/com.atlassian.confluence.extra.officeconnector:converter-macro-web-resources.js?locale=en-GB:5:217
          at http://localhost:27112/c7112/s/f59f3d0ebd727f8430927257d7c31d35-CDN/ce33zg/8701/9e64ae2e14b2a9149d6e55bc661fa83d63f4f188/4a7ee1c57b03455f1f74ef6c18d827e5/_/download/contextbatch/js/_super/batch.js?locale=en-GB:2336:488
      

      Workaround

      Removing the format (bold) fixes the issue.

      Information

      If there are multiple Excel Macros in the page, having any one of them bolded will cause the rest of the excel coming below it to encounter the issue as well

            [CONFSERVER-63523] Office Macros in Confluence don't render document preview if the macro is formatted as bold

            sd nayak added a comment -

            This issue also effects 7.19.12

            sd nayak added a comment - This issue also effects 7.19.12

            Also experienced today with 7.19.2.

            After 15 min of analysis, I have raised the issue to Atlassian Support Team. They have very quickly mentioned the CONFSERVER-63523. Thanks t them.

            Note that the bug may occurs not only with Bold(<strong>) but also with Italic (<i>), Underlying (<u>) and also with Anchor (<a>), which less easy to encounter and to correct.

            For Confluence Development Team :

            • Root Cause :  JSON parameters of Macro should not been stored in macro body as Node Text 
            • Possible Corrections :
              • Store in another way the JSON
              • Or change the way to read the JSON by replacing in relevant JS sources
             AJS.$.find(".converter-macro-parameters")[0].innerHTML

            by

             AJS.$(AJS.$.find(".converter-macro-parameters")[0]).text()

            Perhaps, we will not wait for one year more to see the correction.

            Vincent

            Vincent Thoulé [Alkaes] added a comment - Also experienced today with 7.19.2. After 15 min of analysis, I have raised the issue to Atlassian Support Team . They have very quickly mentioned the CONFSERVER-63523 . Thanks t them. Note that the bug may occurs not only with Bold (<strong>) but also with Italic (<i>), Underlying (<u>) and also with Anchor (<a>), which less easy to encounter and to correct. For Confluence Development Team : Root Cause :  JSON parameters of Macro should not been stored in macro body as Node Text  Possible Corrections : Store in another way the JSON Or change the way to read the JSON by replacing in relevant JS sources AJS.$.find( ".converter-macro-parameters" )[0].innerHTML by AJS.$(AJS.$.find( ".converter-macro-parameters" )[0]).text() Perhaps, we will not wait for one year more to see the correction. Vincent

            Issue affects also 7.13.4

            Enrique Valles García added a comment - Issue affects also 7.13.4

            Brinda E added a comment - - edited

            We also face the same issue with Version 7.13.2, also the number of pages impacted for us more than 3000+. When we can expect the fix to be implemented?

            Brinda E added a comment - - edited We also face the same issue with Version 7.13.2, also the number of pages impacted for us more than 3000+. When we can expect the fix to be implemented?

            Issue affects also 7.4.13 LTS!!!

            Christian Klinger added a comment - Issue affects also 7.4.13 LTS!!!

            Same Issue in 7.13.2

            Hector Salvachua added a comment - Same Issue in 7.13.2

              Unassigned Unassigned
              9f7de485df51 Basar Beykoz
              Affected customers:
              19 This affects my team
              Watchers:
              21 Start watching this issue

                Created:
                Updated: