This issue has been created
 
 
XWiki Platform / cid:jira-generated-image-avatar-48097c0e-9db4-4d07-9240-8ab815df27e8 XWIKI-22326 Open

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

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-77e949c8-fd10-4363-8fe2-cba0e99006c7 Mohamed Boussaa created this issue on 12/Jul/24 11:17
 
Summary: "newline" special character in page name breaks the navigation tree
Issue Type: cid:jira-generated-image-avatar-48097c0e-9db4-4d07-9240-8ab815df27e8 Bug
Affects Versions: 15.10.11, 15.10.8
Assignee: Unassigned
Attachments: browser-console-error.png, created-page.png, navigation-tree-issue.png
Components: Tree, Web - Templates & Resources
Created: 12/Jul/24 11:17
Priority: cid:jira-generated-image-static-major-e45b64f0-1e0d-4fb5-b809-92509a63cb44 Major
Reporter: Mohamed Boussaa
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,
    _thumb_42680.png
  • but the navigation is tree is totally broken, see screenshot
    _thumb_42679.png
  • and this error is visible on the browser console, see screenshot
    _thumb_42678.png
  • 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.