Steps to reproduce
- Open the Copy (or Rename / Create) form of a page
- In the location picker, type in the parent field a space reference that includes the wiki, e.g. xwiki:Space.Target
Expected The location preview (breadcrumb) shows the Space > Target location in the xwiki wiki, and nothing is logged. Actual The location preview is computed for a reference whose wiki is xwiki:xwiki, and errors are logged on the server, e.g.:
and
The copy / rename itself uses the right location. Cause updateLocation in uicomponents/widgets/locationPicker.js resolves the parent field as a space reference, then always calls spaceReference.appendParent(new XWiki.WikiReference(wiki)). When the parent field already contains the wiki, the resolved reference already has a wiki parent, and appendParent adds a second one above it: the reference sent to the hierarchy_reference template is serialized as xwiki:xwiki:Space.Target.WebHome, whose wiki is parsed as xwiki:xwiki. The same file already resolves the parent field with the wiki as a default value instead (XWiki.Model.resolve(parentField.val(), XWiki.EntityType.SPACE, [wiki])), which is what the copy / rename templates do too. Seen on CI with the functional tests CopyPageIT and RenamePageIT, which fill the parent field with a serialized space reference including the wiki. |