Error when importing images with MediaWikiXML and Filter streams converter

The input stream is configured as mediawiki+xml with

Source: url:http://mediawikiurl.com/pagetoimport.xml (I exported the page via Special:Export and copied it the root of the server)
Files: url:http://mediawikiurl.com/images/

The output has the default values, and is configured as xwiki+instance

The import works fine if the page I want to import doesn’t contain images, or if I set attach files to false in the input stream.
Otherwise I get :

   Unsupported input source [class org.xwiki.filter.input.DefaultURLInputSource] ([org.xwiki.filter.input.DefaultURLInputSource@2dad5a91])
class org.xwiki.filter.FilterException: Failed to parse XML
    at org.xwiki.contrib.mediawiki.xml.internal.input.MediaWikiInputFilterStream.read(MediaWikiInputFilterStream.java:310)
    at org.xwiki.contrib.mediawiki.xml.internal.input.MediaWikiInputFilterStream.read(MediaWikiInputFilterStream.java:84)
    at org.xwiki.filter.input.AbstractBeanInputFilterStream.read(AbstractBeanInputFilterStream.java:79)
    at org.xwiki.filter.internal.job.FilterStreamConverterJob.runInternal(FilterStreamConverterJob.java:100)
    at org.xwiki.job.AbstractJob.runInContext(AbstractJob.java:206)
    at org.xwiki.job.AbstractJob.run(AbstractJob.java:189)
    at org.xwiki.filter.script.internal.ScriptFilterStreamConverterJob.run(ScriptFilterStreamConverterJob.java:75)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: class org.xwiki.filter.FilterException: Unsupported input source [class org.xwiki.filter.input.DefaultURLInputSource] ([org.xwiki.filter.input.DefaultURLInputSource@2dad5a91])
    at org.xwiki.contrib.mediawiki.xml.internal.input.MediaWikiInputFilterStream.getFile(MediaWikiInputFilterStream.java:711)
    at org.xwiki.contrib.mediawiki.xml.internal.input.MediaWikiInputFilterStream.sendAttachment(MediaWikiInputFilterStream.java:679)
    at org.xwiki.contrib.mediawiki.xml.internal.input.MediaWikiInputFilterStream.readPageRevision(MediaWikiInputFilterStream.java:642)
    at org.xwiki.contrib.mediawiki.xml.internal.input.MediaWikiInputFilterStream.readPage(MediaWikiInputFilterStream.java:447)
    at org.xwiki.contrib.mediawiki.xml.internal.input.MediaWikiInputFilterStream.readMediaWiki(MediaWikiInputFilterStream.java:351)
    at org.xwiki.contrib.mediawiki.xml.internal.input.MediaWikiInputFilterStream.read(MediaWikiInputFilterStream.java:339)
    at org.xwiki.contrib.mediawiki.xml.internal.input.MediaWikiInputFilterStream.read(MediaWikiInputFilterStream.java:308)
    at org.xwiki.contrib.mediawiki.xml.internal.input.MediaWikiInputFilterStream.read(MediaWikiInputFilterStream.java:84)
    at org.xwiki.filter.input.AbstractBeanInputFilterStream.read(AbstractBeanInputFilterStream.java:79)
    at org.xwiki.filter.internal.job.FilterStreamConverterJob.runInternal(FilterStreamConverterJob.java:100)
    at org.xwiki.job.AbstractJob.runInContext(AbstractJob.java:206)
    at org.xwiki.job.AbstractJob.run(AbstractJob.java:189)
    at org.xwiki.filter.script.internal.ScriptFilterStreamConverterJob.run(ScriptFilterStreamConverterJob.java:75)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

That’s because “Files:” does not support a URL as input right now (yes the description in the UI is not very clear). It only works with a local folder as far as I can see.

Don’t hesitate to create an issue on Loading... to request this improvement. Can’t tell you when someone will be able to work on it but supporting URL should not be very hard if you want to give it a try (see mediawiki/mediawiki-xml/src/main/java/org/xwiki/contrib/mediawiki/xml/internal/input/MediaWikiInputFilterStream.java at master · xwiki-contrib/mediawiki · GitHub).

1 Like

Thanks ! Does the folder need to have every image at its root ? Or does the default MediaWiki hierarchy (0/, 1/, 2/, etc) work as an input ? Will it work with a compressed file ?

the default MediaWiki hierarchy (0/, 1/, 2/, etc) work as an input

Yes. It expect to get the MediaWiki folder.

1 Like