How to retrieve older version of JPG attachments
This article only applies to the Atlassian server platform. Learn more about the differences between cloud and server.
The older version of JPEG attachments isn't accessible from the Confluence UI. Even clicking on the older version from attachment page will only display the latest version of JPEG file
- Navigate to Confluence Page > Attachments.
- Attach the first version of the JPG image in the attachment.
- Attach the second version of the JPG image in the attachment with the same attachment name.
- Click to preview the first version of the JPG image.
All versions of Confluence regardless of the environment
Confluence preview URL is having the parameter version=1 while accessing the second version (latest) of the JPG image
This is a known bug - CONFSERVER-54125Getting issue details... STATUS and the only workaround is to change the format to .png.To access the older version, we would need to manually change the format from .JPG to .PNG in the database
Note the CONTENTID of the JPG image
select contentid from content where title = '<JPG attachment title>' and contenttype='ATTACHMENT'
Update the CONTENT table by replacing .jpg in the title by .png
update content set title='<title of attachment>.png',lowertitle='<title of attachment>.png' where contentid in (select contentid from content where title = '<JPG attachment title>' and contenttype='ATTACHMENT')
Update the CONTENTPROPERTIES table to change the MEDIATYPE property
update contentproperties set stringval='image/png' where propertyname='MEDIA_TYPE' and contentid in (select contentid from content where title = '<JPG attachment title>' and contenttype='ATTACHMENT')
Flush the Cache or Restart Confluence to see the changes in UI
Alwaysyour data before performing any modifications to the database. If possible, test any alter, insert, update, or delete SQL commands on a staging server first.