Details
-
Bug
-
Resolution: Fixed
-
Major
-
5.3
-
Unit
-
Unknown
-
N/A
-
N/A
-
Awaiting Committer feedback
-
Description
If importing a confluence *.xml.zip file which contains an attachment in several version, reading the contentns of attachment throws an error.
For example in the test data for XWIKI-9803.zip this looks like:
java.io.FileNotFoundException: /tmp/confluencexml969810517906866572/attachments/51741193/51937283/1 (No such file or directory) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.<init>(FileInputStream.java:120) at org.xwiki.wikistream.confluence.xml.internal.input.ConfluenceInputWikiStream.readAttachment(ConfluenceInputWikiStream.java:453) at org.xwiki.wikistream.confluence.xml.internal.input.ConfluenceInputWikiStream.readPageRevision(ConfluenceInputWikiStream.java:398) at org.xwiki.wikistream.confluence.xml.internal.input.ConfluenceInputWikiStream.readPageRevision(ConfluenceInputWikiStream.java:332) at org.xwiki.wikistream.confluence.xml.internal.input.ConfluenceInputWikiStream.readPage(ConfluenceInputWikiStream.java:313) at org.xwiki.wikistream.confluence.xml.internal.input.ConfluenceInputWikiStream.read(ConfluenceInputWikiStream.java:248) at org.xwiki.wikistream.confluence.xml.internal.input.ConfluenceInputWikiStream.read(ConfluenceInputWikiStream.java:56) at org.xwiki.wikistream.internal.input.AbstractBeanInputWikiStream.read(AbstractBeanInputWikiStream.java:78) at org.xwiki.wikistream.test.integration.WikiStreamTest.runTestInternal(WikiStreamTest.java:116) at org.xwiki.wikistream.test.integration.WikiStreamTest.execute(WikiStreamTest.java:80)
The test data contains an attachment with two versions:
- first version has id: 51937282 and properties page:51741193, attachmentVersion:2
- second version has id: 51937283 and properties page:51741193, attachmentVersion:1 originalVersion:51937282
The content of the attachment is looked up at attachments/51741193/51937283/1
while it is actually in attachments/51741193/51937282/1
The path to find the attachmen should use attachments/<originalVersion>/<attachmentVersion> whenever originalVersion is given, and only use the id as fallback.
I think I can work out a patch for that.