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

After migration from 3.5.13 to 4.2.x, 4.3.x and 5.5.1 In page anchor displays with #anchorname instead of just anchorname

      Description

      Upgrade OOB 3513 with 1 page with in-page anchor.

      Upgraded instance shows the same page with anchor as #anchorname.

      Workaround

      You can inject SQL query to remove the hash from the link. For example this is the SQL query for MySQL.

      UPDATE BODYCONTENT SET BODY = REPLACE(BODY, 'link-body>#', 'link-body>') WHERE BODY LIKE '%ac:anchor%link-body>#%';
      

            [CONFSERVER-25882] After migration from 3.5.13 to 4.2.x, 4.3.x and 5.5.1 In page anchor displays with #anchorname instead of just anchorname

            Tomas added a comment -

            Same problem in 7.4.0

            Tomas added a comment - Same problem in 7.4.0

            Minh Tran added a comment -
            Atlassian update

            Thank you for taking the time to raise, comment or vote on this Bug. Currently this bug indicates that it only impacts a version of Confluence which is no longer in support, therefore we are closing this issue as Timed Out.
            If this issue is still impacting you on a recent version please feel free to comment with the affected version. Any further details you may be able to provide regarding reproduction or impact of this issue may help us better address this issue.
            Thanks again.
            Regards,
            Confluence Development

            Minh Tran added a comment - Atlassian update Thank you for taking the time to raise, comment or vote on this Bug. Currently this bug indicates that it only impacts a version of Confluence which is no longer in support, therefore we are closing this issue as Timed Out. If this issue is still impacting you on a recent version please feel free to comment with the affected version. Any further details you may be able to provide regarding reproduction or impact of this issue may help us better address this issue. Thanks again. Regards, Confluence Development

            The workaround doesn't work in MS SQL Server because you cannot REPLACE on a TEXT column.
            If using SQL Server 2008 or above, you can fix the statement by CAST'ing to VARCHAR(MAX).

            Also, if anyone has edited any of the affected pages the mark-up changes from:
            <ac:link-body>#name</ac:link-body>
            to:
            <ac:plain-text-link-body><!CDATA[#name]></ac:plain-text-link-body>

            So, you must run two REPLACEs:

            print 'Un-edited links ...'
            UPDATE BODYCONTENT SET BODY = REPLACE(cast(BODY as varchar(max)), '<ac:link-body>#', '<ac:link-body>')
            WHERE BODY LIKE '%ac:anchor%<ac:link-body>#%'
            print 'Edited links (if any) ...'
            UPDATE BODYCONTENT SET BODY = REPLACE(cast(BODY as varchar(max)), '<ac:plain-text-link-body><![CDATA[#', '<ac:plain-text-link-body><![CDATA[')
            WHERE BODY LIKE '%ac:anchor%<ac:plain-text-link-body><![[]CDATA[[]#%'

            --------
            Sorry, because this website doesn't let you escape markup in comments the above is a mess. I'll attach a file with this comment in it!

            Peter Binney added a comment - The workaround doesn't work in MS SQL Server because you cannot REPLACE on a TEXT column. If using SQL Server 2008 or above, you can fix the statement by CAST'ing to VARCHAR(MAX). Also, if anyone has edited any of the affected pages the mark-up changes from: <ac:link-body>#name</ac:link-body> to: <ac:plain-text-link-body><! CDATA[#name] ></ac:plain-text-link-body> So, you must run two REPLACEs: print 'Un-edited links ...' UPDATE BODYCONTENT SET BODY = REPLACE(cast(BODY as varchar(max)), '<ac:link-body>#', '<ac:link-body>') WHERE BODY LIKE '%ac:anchor%<ac:link-body>#%' print 'Edited links (if any) ...' UPDATE BODYCONTENT SET BODY = REPLACE(cast(BODY as varchar(max)), '<ac:plain-text-link-body><![CDATA[#', '<ac:plain-text-link-body><![CDATA[') WHERE BODY LIKE '%ac:anchor%<ac:plain-text-link-body><![[]CDATA[[]#%' -------- Sorry, because this website doesn't let you escape markup in comments the above is a mess. I'll attach a file with this comment in it!

              Unassigned Unassigned
              rgoodwin Ryan Goodwin (Inactive)
              Affected customers:
              5 This affects my team
              Watchers:
              11 Start watching this issue

                Created:
                Updated:
                Resolved: