Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-22326

"newline" special character in page name breaks the navigation tree

    XMLWordPrintable

Details

    • Easy
    • N/A
    • N/A

    Description

      I noticed that it is possible to programmatically create wiki pages that contains the newline special character ('0A' or LF) in their names, for example using the Confluence Migrator application.

      The issue is that having a page that contains a newline character in its name will totally break any navigation tree (Navigation panel, breadcrumb ...) in the page itself and also in the page parents.

      The issue is easily reproductible by creating programatically a page containing a line separator in its name even if we first apply the default XWiki name strategy on the page name. See script below :

      {{groovy}}
      def pageName = "PageWithLine" + System.lineSeparator() +  "Separator";
      pageName = services.modelvalidation.transformName(pageName);
      def vdoc = xwiki.getDocument("Main." + pageName);
      vdoc.save()
      {{/groovy}}
      

      Results :

      • The page is created, see screenshot,
      • but the navigation is tree is totally broken, see screenshot
      • and this error is visible on the browser console, see screenshot
      • Other features are broken, ex : page exports as it uses a navigation tree to select exported pages

      Basically, page names are used as HTML IDs of navigation trees items without any escaping which is breaking jstree.

      Attachments

        1. browser-console-error.png
          254 kB
          Mohamed Boussaa
        2. created-page.png
          203 kB
          Mohamed Boussaa
        3. navigation-tree-issue.png
          210 kB
          Mohamed Boussaa

        Activity

          People

            mflorea Marius Dumitru Florea
            mouhb Mohamed Boussaa
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: