Attachments got duplicated
Symptoms
Attachments of an issue appear multiple times in the original or synced issue. After changing one of the issues some or all attachments continue duplicating.
Cause
The duplication is caused by a bug in Backbone Cloud prior to version 3.0.100-AC: BAC-1660.
Resolution
No new duplications should appear after release 3.0.100-AC. In case this does happen, please reach out to help@k15t.com
For existing duplications you can use this python script to clean up attachments and related comments: removeDuplicateAttachmentsCloud.py.zip
Prerequisites
You need to have Python 3 installed on your computer.
Step-1: Create a Jira API token
In order to run the script you need a Jira API token. You can generate one as described in the Jira Cloud documentation.
Step-2: Find issues with duplicated attachments
Run
python -m pip install requests
in the root directory of the scripts to install the requests module for python.Run
python removeDuplicateAttachmentsCloud.py --url=<url_of_your_jira_instance> --user=<your_jira_user> --apiToken=<your_api_token_from_step_1> --project=<project_to_check> --dry-run
.The result shows attachments and comments (if the project is a JSM project) which are potential duplicates. You can also see the issue keys of these duplicates.
Check the shown attachments and comments, which the script would delete and decide if there are any issues you don’t want to clean up.
All attachments and comments deleted by the script cannot be recovered. Please check carefully before continuing with step 3.
Step-3: Cleanup duplicated attachments and comments
Phrase a JQL statement containing all issues you want to cleanup. A statement could look like this:
issuekey IN ("SW1-45", "SW1-46", "SW1-47")
.If you want to remove all duplicates from all issues, you don’t need to phrase a JQL.
Run
python removeDuplicateAttachmentsCloud.py --url=<url_of_your_jira_instance> --user=<your_jira_user> --apiToken=<your_api_token_from_step_1> --project=<project_to_check> --jql=<your_jql_from_step_3-1>
.
Now all duplicate attachments and comments should be deleted.