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

Copying page with linked attachment or with a link to a page in the same space to another space will break those links


      NOTE: This bug report is for Confluence Server. Using Confluence Cloud? See the corresponding bug report.


      copy a page with linked attachment to another space will break the attachment link

      Steps to Reproduce

      1. Create a page, insert an attachement (attachment1.jpg)
      2. Create a new page within the same space
      3. Insert a link of the attachement by:
        • Click Insert more content
        • Files and Images
        • Search on other pages > Search for the attachment >(write "attachment1 on the field) Search > Choose the image > Insert
        • Save Page
      4. Move this page to other space by:
        • Tools
        • Copy
        • Set New Location to new space and parent page
      5. Save

      This also happens when copying a page with a link to pages on the same space and trying to copy it:

      The source of the origin page is:

      <p class="auto-cursor-target"><ac:link><ri:page ri:content-title="Page B" /></ac:link></p>
      <p class="auto-cursor-target"><ac:link><ri:page ri:space-key="another space" ri:content-title="Page C" /></ac:link></p>
      <p><br /></p>

      Note that if the link is from a page on the same space, the space name is NOT saved on the html file. In case the link is to a page to another space, it is.

      When copying it does not change that as it does when you move. 

      This is the storage format of a page after you move it:

      <p><ac:link><ri:page ri:content-title="Page 2" ri:space-key="SOUR" /></ac:link></p>
      <p><ac:link><ri:page ri:space-key="FOR" ri:content-title="Page 3" /></ac:link></p> 

      And this is the storage format after you copy it:

      <p><ac:link><ri:page ri:content-title="Page 2" /><ac:plain-text-link-body><![CDATA[Page 2]]></ac:plain-text-link-body></ac:link></p>
      <p><ac:link><ri:page ri:space-key="FOR" ri:content-title="Page 3" /></ac:link></p> 

      Expected Results

      Page copied normally with the attachment link and page links still intact.

      Actual Results

      The image link has broken.

      The linked page is not correctly referenced and when clicked on its link on the newly copied page it offers to create a new page.


      Copy to somewhere in same space then move to new location in new space:

      • Tools
      • Copy
      • Save to a temporary location within same space
      • Tools
      • Move
      • Set New Location to new space and new parent page

      Moving the page to a new space will properly reference the linked page.


      Upon investigating, it seems like there is a difference of macro defined to link attachemnet from the same space and from different space
      Storage format of page containing attachment from the same space:

      <p><ac:image><ri:attachment ri:filename="connie.PNG"><ri:page ri:content-title="Confluence" /></ri:attachment></ac:image></p>

      Storage format of page containing attachment from different space:

      <p><ac:image ac:height="250"><ri:attachment ri:filename="connie.PNG"><ri:page ri:content-title="Confluence" ri:space-key="T5S" /></ri:attachment></ac:image></p>

      (note the "space-key")

      For more information please check the screencast attached

        1. attachmentbug.mp4
          2.41 MB
        2. Capture.PNG
          6 kB

            Unassigned Unassigned
            mkhairuliana Monique Khairuliana (Inactive)
            61 Vote for this issue
            53 Start watching this issue