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

Office import creates an empty page when the default syntax is provided by an extension installed on the wiki

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • 19.0.0-rc-1
    • 17.10.0
    • Office
    • None
    • Unknown

    Description

      Steps to reproduce

      1. Install a syntax extension on the main wiki only (not on the farm), for example the BlockNote syntax.
      2. In the wiki administration, set that syntax as the default page syntax.
      3. Import an office document (.odt, .docx) with the Office Importer application, without splitting it into child pages.

      Expected result

      The page is created with the content of the office document, in the default page syntax, and with the images of the document attached.

      Actual result

      The page is created with the default page syntax but its content is empty, and no image is attached. The import reports no error. The only trace is in the logs, when the Mentions indexer parses the new page:

      com.xpn.xwiki.XWikiException: Error number 0 in 4: Failed to parse content of syntax [blocknote/1.0]
      ...
      Caused by: org.xwiki.rendering.parser.ParseException: The BlockNote root element must be a JSON array.
      

      The same import works when the document is split into child pages.

      Cause

      DefaultXDOMOfficeDocumentBuilder passes the root component manager to XDOMOfficeDocument, whose getContentAsString(syntaxId) looks up the renderer there. The root component manager doesn't see the components of extensions installed on a wiki, so the lookup fails, getContentAsString returns null without logging anything, and ModelBridge saves that as the page content. DefaultOfficeDocumentSplitter and DefaultPresentationBuilder already use the context component manager, which is why the split import works.

      A syntax installed on the farm (for example Markdown, which the Extension Manager installs on the farm) is registered in the root component manager, which hides the problem.

      Attachments

        Issue Links

          Activity

            People

              nciausu Nicoleta Ciausu
              mflorea Marius Dumitru Florea
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: