Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-25608

Repository /extensions/{extensionId} REST endpoint fails with a 500 error for extensions using version pages

    XMLWordPrintable

Details

    • Unknown
    • N/A
    • N/A

    Description

      Steps to reproduce

      1. 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:

      jakarta.servlet.ServletException: javax.servlet.ServletException: java.lang.IllegalArgumentException: An Entity Reference name cannot be null or empty
      

      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.

      Attachments

        Issue Links

          Activity

            People

              mleduc Manuel Leduc
              surli Simon Urli
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: