The autocompletion for spaces and pages inserts an & for any & in a selected space / page name
Steps to Reproduce:
- go to any page, e.g. Sandbox.Webhome
- choose "Add" -> "Page" and type in "Foo & Bar" as page name and click on "Create"
- on the following page click "Save & View" to really create the page in the DB
- click on "edit" to go back to the edit view
- click on the "edit parent" icon
- a text field for the parent appears with contents 'Sandbox.WebHome'
- Remove the "WebHome part and type in 'Foo' and wait a moment for the autocompletion results to appear
- When the results appear, click on the 'Sandbox.Foo & Bar'
Expected Result: "Parent" field should be filled with 'Sandbox.Foo & Bar'
Actual Result: "Parent" field is filled with 'Sandbox.Foo & Bar'
(The is another quirk here that you can set a page to the parent of itself, with consequences not clear to me, but that is maybe a separate issue.)
One possibility to fix this is in the file xwiki-platform-core/xwiki-platform-web/src/main/webapp/resources/uicomponents/suggest/suggest.js
where around line 835 one has
As this reads the content as HTML, a (clumsy) fix is to read it as text instead, e.g.
Mabye there is a better way to get around the browser incompatibilities of getting the text content of a node.