Jira attachments broken after importing from CSV file
Platform Notice: Cloud Only - This article only applies to Atlassian products on the cloud platform.
Summary
When migrating between two Jira Cloud sites using the External System Import with a CSV file, you may get an error when loading an attachment of a migrated issue.
For image attachments, the first thing you'll note is that the thumbnail is broken:

Then, when clicking on it you'll get an error:

Solution
Add API authentication to URLs in exported CSV
Imported attachments break when the CSV file references attachments that are not publicly accessible. See an example below:
1
18/Jul/23 3:53 PM;image.png;https://mysite.atlassian.net/rest/api/2/attachment/content/10000
Since this file is not accessible unless already logged in to this Jira site, the CSV importer cannot access it either.
To correctly import attachments, a user with access to the source site and the issues being imported must:
Edit the CSV file
Change all attachment URLs to include API authentication
Re-import the CSV file
⚠️ Please beware that some applications commonly used to edit CSV files may automatically reformat when you save the file, breaking the file for import use.
See an example below of the necessary edit to our example attachment.
1
2
3
4
5
Original exported link
18/Jul/23 3:53 PM;image.png;https://mysite.atlassian.net/rest/api/2/attachment/content/10000
Edited authenticated link
18/Jul/23 3:53 PM;image.png;https://user%40domain.com:<API-Token>@mysite.atlassian.net/rest/api/2/attachment/content/10000
Note that the '@' symbol on the email address should be replaced with the HTML character '%40', followed by a colon and the API token
Finally, put an '@' symbol just before the hostname of your Cloud site
The rest of the URL will stay the same
If the source site is Jira Data Center
Instead of using your Jira Cloud Email Address and API-Token, you must use your Jira Data Center Username and Password instead. For example,
1
2
3
4
5
Original exported link
18/Jul/23 3:53 PM;image.png;https://mysite.atlassian.net/rest/api/2/attachment/content/10000
Edited authenticated link
18/Jul/23 3:53 PM;image.png;https://adminuser:password@myjirasite.com/secure/attachment/10000/filename
Notes:
If the password or username has special characters, such as #, ^, %, $, *, etc, then they must be replaced by their URL Encoded equivalent
This method does not support external authentication methods such as Single Sign On - you must use local credentials for the Jira On-Prem account
Its recommended to reset the account credentials after all CSV imports have been completed to Jira Cloud
Was this helpful?