Uploaded image for project: 'Confluence Cloud'
  1. Confluence Cloud
  2. CONFCLOUD-81437

Confluence Page with styled fonts and has comments over hyperlink gives wrong data when using wiki/api/v2/pages/{id} with body format equal to export_view

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Low Low
    • Page - Content APIs
    • None

      Issue Summary

      When a Confluence page has some words styled with colors and hyperlink on the paragraph, and there is a comment that encompasses the hyperlink, by requesting the endpoint https://developer.atlassian.com/cloud/confluence/rest/v2/api-group-page/#api-pages-id-get using the body-format query parameter as export_view. The returned body has some issues, such as the <style> element is missing, and the link element still contains the inline-comment-marker, even though that is supposed to be removed/converted to proper HTML in this format.
       

      Steps to Reproduce

      1. Create a new Confluence page
      1. Insert some text in the first paragraph and apply some text color to part of the text with the Text Color option in the editor toolbar
      1. In the second paragraph, add a link to a different Confluence page on the same instance
      1. Save the page
      1. Inspect the storage and export_view format of the page, for example via the REST API with the https://<INSTANCE>.atlassian.net/wiki/api/v2/pages/<PAGE_ID>?body-format=storage and https://<INSTANCE>.atlassian.net/wiki/api/v2/pages/<PAGE_ID>?body-format=export_view endpoints

       

       

      The storage format will look something like this:
       

      <p>F<span style="color: rgb(54,179,126);">o</span>o</p>
      <p>
          <ac:link>
              <ri:page
                  ri:space-key="TEST"
                  ri:content-title="Pagetitle"
                  ri:version-at-save="1"
              />
              <ac:link-body>Link to a page</ac:link-body>
          </ac:link>
      </p> 

      And the view format is something like this (note the <style> attribute that connects the data-colorid attribute in the same paragraph with an actual color value based on the user's theme):
       

      <p>
          <style>[data-colorid=d5m2ygw4h6]{color:#36b37e} html[data-color-mode=dark] [data-colorid=d5m2ygw4h6]{color:#4cc994}</style>
          F<span data-colorid="d5m2ygw4h6">o</span>o
      </p>
      <p>
          <a
              href="https://<instance>.atlassian.net/wiki/spaces/<spaceKey>/pages/<pageId>/Pagetitle"
              data-linked-resource-id="2111766555"
              data-linked-resource-version="1"
              data-linked-resource-type="page"
              >Link to a page</a
          >
      </p> 

      To trigger the bug, follow these steps on the same page:

      1. In the Confluence page view, click and drag the mouse to select the text of the page link in the second paragraph (“Link to a page” in the example above)
      1. In the floating toolbar, click “Comment” to create an inline comment, add some arbitrary text in the following textbox, and save the inline comment
      1. Inspect the storage and export_view format of the page again with the same mechanism as before

      The storage format afterward will look something like this, with an added <ac:inine-comment-marker> element applied to the link text

       

      <p>F<span style="color: rgb(54,179,126);">o</span>o</p>
      <p>
          <ac:link>
              <ri:page
                  ri:space-key="TEST"
                  ri:content-title="Some page title"
                  ri:version-at-save="1"
              />
              <ac:link-body>
                  <ac:inline-comment-marker ac:ref="c8b8407b-f1ca-4747-9633-4858dc3ab289">Link to a page</ac:inline-comment-marker>
              </ac:link-body>
          </ac:link>
          <ac:inline-comment-marker ac:ref="c8b8407b-f1ca-4747-9633-4858dc3ab289" />
      </p> 

       
      And the view format is something like this, where the <style> element is missing, and the link element still contains the inline-comment-marker even though that is supposed to be removed/converted to proper HTML in this format.
       
       

      <p>F<span data-colorid="bf9ssy5tkc">o</span>o</p>
      <p>
          <a
              href="https://<instance>.atlassian.net/wiki/spaces/<spaceKey>/pages/<pageId>/Pagetitle"
              data-linked-resource-id="2111766555"
              data-linked-resource-version="1"
              data-linked-resource-type="page"
              >
                 <ac:inline-comment-marker ac:ref="c8b8407b-f1ca-4747-9633-4858dc3ab289">Link to a page</ac:inline-comment-marker>
              </a>
              <span class="inline-comment-marker" data-ref="c8b8407b-f1ca-4747-9633-4858dc3ab289"> </span>
      </p> 

       

       

      Expected Results

      Returns the correct body for export_view

       

      Actual Results

      The <style> element is missing, and the link element still contains the inline-comment-marker even though that is supposed to be removed/converted to proper HTML in this format.

      Workaround

      Currently there is no known workaround for this behavior. A workaround will be added here when available

              Unassigned Unassigned
              6f0957aa1bcc Emmanuel Bellezza
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: