| Steps to reproduce
- Request the REST resource of an extension whose versions are stored in dedicated version pages, without a version: e.g. https://extensions.xwiki.org/xwiki/rest/repository/extensions/org.xwiki.platform:xwiki-platform-image-style-rest
Expected results The extension metadata (id, name, summary, authors, properties, etc.) is returned, as it is for extensions which don't use version pages (e.g. https://extensions.xwiki.org/xwiki/rest/repository/extensions/org.xwiki.contrib:application-xambox). Actual results An HTTP 500 error is returned:
Analysis ExtensionRESTResource calls AbstractExtensionRESTResource#createExtension(extensionDocument, null), a null version meaning "no specific version". Since XWIKI-14136, createExtension always starts by resolving the version document with ExtensionStore#getExtensionVersionDocument(extensionDocument, version, xcontext). When the extension uses version pages, that builds a PageReference named after the version, which fails for a null version. The version document is only needed for the dependencies, which are only computed when a version is given, so it should only be resolved in that case. Regression introduced by XWIKI-14136 (same origin as XWIKI-23996, which fixed the /extensions listing). The endpoint is not used by the XWiki extension repository client, so this only affects direct REST users. Found while investigating XWIKI-25602. |