Details
-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
10.6
-
None
-
Unknown
-
Description
XWiki#getDocumentReference(EntityReference) (and so XWiki#getDocument(EntityReference, XWikiContext) and the script API $xwiki.getDocument(EntityReference)) does not resolve a relative page reference (an EntityReference of type PAGE without its wiki or parent pages) the way it resolves a relative document reference: the missing parts come from the default values (main wiki, Main page) instead of the current context.
The cause is AbstractCurrentGetReferenceResolver#resolveInternal, which completes PAGE related references with the default PageReferenceResolver, while DOCUMENT related references go through the current one. The class even injects a current PageReferenceResolver which is never used.
It does not affect PageReference instances, which always contain the wiki, only relative references built as EntityReference.
STEPS TO REPRODUCE:
- Have the context on the wiki subwiki
- Call XWiki#getDocumentReference with the relative document reference new EntityReference("Page", EntityType.DOCUMENT, new EntityReference("Space", EntityType.SPACE))
- Call it with the equivalent relative page reference new EntityReference("Page", EntityType.PAGE, new EntityReference("Space", EntityType.PAGE))
EXPECTED RESULTS:
Both references are resolved in the current wiki: subwiki:Space.Page for the document reference, and subwiki:Space.Page.WebHome (or subwiki:Space.Page if only the terminal document exists) for the page reference.
ACTUAL RESULTS:
The document reference is resolved to subwiki:Space.Page, but the page reference is resolved to xwiki:Space.Page.WebHome, in the main wiki.
Attachments
Issue Links
- relates to
-
XWIKI-25748 The page_object_property source type of the code macro always fails with a NullPointerException
-
- Open
-
-
XWIKI-15403 Add support for page reference in XWiki#getDocument API
-
- Closed
-