This issue has been created
There are 5 updates.
 
 
XWiki Platform / cid:jira-generated-image-avatar-12e838fd-cfa6-4fd2-9af4-05c1dda6b500 XWIKI-25222 Open

The location preview uses a wrong wiki and errors are logged when the parent field of the location picker contains the wiki

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-b93dd204-d01e-4c1b-a1b9-e43316bc4838 Simon Urli created this issue on 08/Oct/26 17:06
 
Summary: The location preview uses a wrong wiki and errors are logged when the parent field of the location picker contains the wiki
Issue Type: cid:jira-generated-image-avatar-12e838fd-cfa6-4fd2-9af4-05c1dda6b500 Bug
Affects Versions: 7.2-milestone-3
Assignee: Unassigned
Components: Web - Templates & Resources
Created: 08/Oct/26 17:06
Priority: cid:jira-generated-image-static-major-c4290cc5-a09b-41af-8aa4-ea53fc0710a9 Major
Reporter: Simon Urli
Description:

Steps to reproduce

  1. Open the Copy (or Rename / Create) form of a page
  2. 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.:

ERROR ghtCheckerAuthorizationManager - Failed to load rights for user [xwiki:XWiki.CopyRightsUser] on [Space xwiki:xwiki:NestedCopyPageIT].
org.xwiki.security.authorization.AuthorizationException: Could not retrieve the document to check security access when checking access to [xwiki:xwiki:XWiki.XWikiPreferences]
Caused by: com.xpn.xwiki.XWikiException: Error number 2 in 0: No wiki with id [xwiki:xwiki] could be found

and

ERROR c.x.x.d.XWikiDocument - Error when loading document [xwiki:xwiki:CopyWithChildrenTarget.WebHome] for locale [en]
Caused by: com.xpn.xwiki.XWikiException: Error number 2 in 0: No wiki with id [xwiki:xwiki] could be found

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.

 
 

5 updates

 
cid:jira-generated-image-avatar-b93dd204-d01e-4c1b-a1b9-e43316bc4838 Changes by Simon Urli on 08/Oct/26 17:06
 
Fix Version: 18.9.0-rc-1
Fix Version: 17.10.14
Fix Version: 18.4.7
Assignee: Simon Urli
Labels: bugfixingday