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. |