Import/Export confluence space: Why do some @mentions fail gracefully and others break?

We're in the process of exporting a confluence space from one instance to another. 

In this context, we've discovered that mentions break upon import into another instance, as they reference the user by some unique user identifier from the database. For some mentions, however, the link breaks but the name of the referenced user is displayed (i.e. it fails gracefully). In this case, the storage format in the SOURCE wiki looks like this:  

  <ri:user ri:userkey="<32hexdigits>" />
    <![CDATA[Lastname Firstname]]>

For other mentions, the link breaks and a "broken image" icon is shown instead, with no easy way of discerning the user that was mentioned originally. In this way, the storage format in the SOURCE wiki looks like this: 

<ac:link><ri:user ri:userkey="<32hexdigits>" /></ac:link>

I realize this is a long shot, but does anyone know what makes a mention use the former (more gracefully failing) format, rather than the latter?

Also, if anyone has experience with fixing up mentions after an export/import to another system, I'd be interested in your solution. 







1 answer

Hi Michael,

The "32hexdigits" is the user key of the user in Confluence. The user key is mapped to a username and a user with this username is looked up in the user directories registered in Confluence. If a user is not found the macro breaks.

When doing imports from another instance you need to make sure that all the users from the source instance are available inside the target instance - and the usernames should match. The importer looks the users by name and fixes the references inside pages (fixes the userkey), but if the user is not found then the importer leaves the old user key (the one from the source instance).

To fix this you have a few options:

  • Ensure the users from source are available on target and then do the import again
  • Run a SQL script to fix the user keys inside the ri:userkey=" attribute - THIS IS DANGEROUS AND YOU NEED TO BE SURE YOU KNOW WHAT YOU'RE DOING before taking this approach
  • Write a groovy script with script runner to fix all the pages with broken user mentions macro - might be slow if you have large set of pages to scan but much safer than the SQL approach


Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Feb 06, 2019 in Confluence

Try out the new editing experience

Hi team, I’m Avinoam, a product manager on Confluence Cloud, and today I’m really excited to let the Community know that all customers can now try out the new editing experience and see some of the ...

897 views 45 7
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you