-
Bug
-
Resolution: Fixed
-
Low
-
7.19.1, 8.1.0
-
15
-
Severity 3 - Minor
-
2
-
Problem
Space XML exports from Confluence Cloud which have Space templates that contain 'full-width' template properties will cause Space imports into Confluence Server/DC to break, possibly causing a partial import.
Environment
- Space export from Confluence Cloud, which contains templates that have 'full-width' TemplateProperty classes.
- Tested in Confluence Server/DC v7.19.1, but could be any current version of Confluence Server/Data Center (7+)
Steps to Reproduce
- In Confluence Cloud, create a full-width Space template. Create a page with this template and save.
- Export the Confluence Cloud Space as XML, full export.
- In Confluence Server/DC, restore this space into your on-prem deployment.
Expected Results
The space imports without issue.
Actual Results
The importer fails after the 'TemplateProperty' XML is read with the following error in the application logs:
2022-09-30 15:21:26,555 ERROR [Long running task: Importing data] [confluence.importexport.xmlimport.BackupImporter] importEntities Cannot import the entities: -- url: /c7191/admin/restore-local-file.action | referer: http://localhost:27191/c7191/admin/backup.action | traceId: 6d792714d69ba9d6 | userName: admin | action: restore-local-file com.atlassian.confluence.importexport.ImportExportException: Unable to complete import: Error while importing backup: com.atlassian.confluence.pages.templates.TemplateProperty at com.atlassian.confluence.importexport.xmlimport.DefaultXmlImporter.doImportInternal(DefaultXmlImporter.java:68) ...
Workaround
- Export the Confluence Cloud export.
- Uncompress the export .zip.
- Create a quick backup of entities.xml.
- Edit the entities.xml file and remove all <OBJECT> and <COLLECTION> XML blocks that use class="TemplateProperty". For instance, this whole block should be removed as it pertains to all data within it which uses class="TemplateProperty" within the scope of the <OBJECT> and </OBJECT> tags:
<object class="TemplateProperty" package="com.atlassian.confluence.pages.templates"> <id name="id">1376257</id> <property name="hibernateVersion">2</property> <property name="name"><![CDATA[content-appearance]]></property> <property name="value"><![CDATA[full-width]]></property> <property name="version">2</property> <collection name="historicalVersions" class="java.util.Collection(com.atlassian.confluence.pages.templates.TemplateProperty.historicalVersions)"><element class="TemplateProperty" package="com.atlassian.confluence.pages.templates"><id name="id">1605633</id> </element> </collection> <property name="pageTemplate" class="PageTemplate" package="com.atlassian.confluence.pages.templates"><id name="id">1343489</id> </property> <property name="creator" class="ConfluenceUserImpl" package="com.atlassian.confluence.user"><id name="key"><![CDATA[557057:ffd3d61c-ced9-46cb-a52a-c70b4da7c474]]></id> </property> <property name="creationDate">2022-10-14 15:27:19.448</property> <property name="lastModifier" class="ConfluenceUserImpl" package="com.atlassian.confluence.user"><id name="key"><![CDATA[557057:ffd3d61c-ced9-46cb-a52a-c70b4da7c474]]></id> </property> <property name="lastModificationDate">2022-10-14 16:11:07.069</property> </object>
- Once all of these <OBJECT> blocks pertaining to class="TemplateProperty" have been removed, save the entities.xml.
- Zip up the whole content of the uncompressed folder into a zip. Be sure to make sure that the contents are not added into a top-level folder when compressing. i.e. entities.xml and exportDescriptor.properties need to be on the root level of the zip.
- <OPTIONAL> If you have already imported this space once and it failed midway through, you can use After a failed space import, it's not possible to re-import because of leftover space data KB to delete this space from the DB. Be sure to shutdown Confluence and take a backup of the DB before updating the DB!
- Import the Space zip into your Confluence DC instance.
Notes
- Setting the 'full-width' back to 'default' does not seem to work for Space templates, runs across the same error on the importer.
- After running the workaround and importing the Space into Confluence Server/DC, pages that used the Space template will retain the user-generated formatting, but not the Space template formatting, so you will need to manually fix this in the editor.
- For the workaround, no user-created data is altered, we are simply removing the properties for the Space template which have the unsupported values, the data will remain. For templates that do NOT use full-width will import as normal, assuming that the class="TemplateProperty" XML doesn't exist for that template in the entities.xml.