JILS-30: Attachments functionality broken

Issue Information

Issue Type: Bug
Priority: Major
Status: Closed

Reported By:
Ben Tasker
Assigned To:
Ben Tasker
Project: Jira Issue Listing Script (JILS)
Resolution: Fixed (2016-04-29 15:04:38)
Affects Version: 0.01b,
Target version: 0.01b,

Created: 2015-09-16 12:28:03
Time Spent Working

Attachments to recent issues result in a 404.

Attachments to older issues still seem to work, suggesting something in the logic is wrong.

For example, although the following attachment ID's are available

- 11512
- 11516
- 11517

Attachment ID 11513 isn't (and presumably 11514, 11515).

Need to try and figure out why

Toggle State Changes


Within the Issue view page, the link to an attachment is generated by


Nothing in qs2sef (https://github.com/bentasker/Jira-Issue-Listing/blob/4304af6e6382f2ff6d21cd216f76a5bc69e62d03/utils.class.php#L407) looks too far out.

It looks like parseSEF (https://github.com/bentasker/Jira-Issue-Listing/blob/4304af6e6382f2ff6d21cd216f76a5bc69e62d03/utils.class.php#L470) is doing it's job OK and getting us into the attachments processing.
huh.... that's odd...

Looking in /var/atlassian/application-data/jira/data/attachments/ it seems that JIRA uses a project's original key, rather than the current one. The project I noticed this on originally had a different key.

So, assuming the following

Project Key: EXAMPLE
Original Project Key: ANEXAMPLE

Attachments for any issues under that project won't be in /var/atlassian/application-data/jira/data/attachments/EXAMPLE but in /var/atlassian/application-data/jira/data/attachments/ANEXAMPLE (to be clear, even if the issues were created after the project key changed).

So, if the attachment file we're looking for doesn't exist, we should probably connect to the database and see whether ORIGINALKEY exists. Either that, or use it when generating the initial link.

The problem with doing the latter is if it was changed for a reason (e.g. was an expletive) then URL paths will go back to containing that key.

As attachment.php already connects to the database, it's probably just as simple to take the project key, grab the original key from the database and then use that when building the file path.

Repo: Jira-Issue-Listing
Commit: 58ff4c8dac44578b2cbba6a5c6f5cb774f6b5186
Author: Ben Tasker <github@<Domain Hidden>>

Date: Wed Sep 16 13:01:15 2015 +0100
Commit Message: Fixed attachment file paths for JILS-30

Modified (-)(+)

Webhook User-Agent


View Commit

btasker changed status from 'Open' to 'Resolved'
btasker added 'Fixed' to resolution
btasker changed status from 'Resolved' to 'Closed'
Re-opening to assign to a version
btasker removed 'Fixed' from resolution
btasker changed status from 'Closed' to 'Reopened'
Assigning to v0.01b
btasker added '0.01b' to Version
btasker added '0.01b' to Fix Version
btasker changed status from 'Reopened' to 'Resolved'
btasker added 'Fixed' to resolution
btasker changed status from 'Resolved' to 'Closed'