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

Redirect to anchors in pages with titles that contain special characters is broken

    XMLWordPrintable

Details

    Description

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

      Symptoms

      When a page name contains a special character, this character is included in the ID of any anchors on the page. When generating the URL for such anchors, Confluence is encoding any text to the right of the # using HTML entity escaping, but for this link to work, it must use URL encoding. This also happens if an anchor name contains a special character.

      For example the apostrophe character:

      • The URL is currently replacing it with '
      • The URL should be replacing it instead with %27 like it does on the left side of the #
      • The anchor is showing up correctly in the page source, as the apostrophe is not encoded inside the id attribute

      Note that whilst using special characters in an ID is prohibited in XML and thus XHTML, it's perfectly fine for HTML5, which is used by Confluence, so any special characters do not need to be encoded inside the id attribute.

      Steps to reproduce:

      1. Create a page named "User's Resources"
      2. Add an anchor to it, say "shares", a link to the anchor in the same page (or any other) and save
      3. Click the link
      4. No redirect is made (or if the link is in a different page, redirect is made only to the page, not the anchor)

      This is the link:

      <confluence_instance>/display/<space_name>/User%27s+Resources#User&#39;sResources-shares

      This behavior happens because of the special character used in the title - If the page is renamed without it, everything works.

      Workaround

      If this is caused by the page name, the only workaround is to rename that page to not have a special character.

      If this is caused by the anchor name, you can work around this by manually URL-escaping the special character in the "Link" value in "Advanced" when creating the link.

      Attachments

        Issue Links

          Activity

            People

              dma@atlassian.com David Ma
              363db42e39fc Stefan Uricariu
              Votes:
              34 Vote for this issue
              Watchers:
              78 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: