PDF attachment icon in Assets shows as Word
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
Assets attachments saved as PDFs show Word icons on the UI.
Diagnosis
We can investigate this with a HAR file or Database query.
Create a HAR file while loading the page. Please refer to the example given below. Filename has pdf extension, but the mimeType is officedocument. For PDF documents we expect this to be application/PDF type.
Har file
1 2 3 4 5
"filename": "1eff0303-80ac-46b9-89d5-89caac7f878c.pdf", "size": "506.2 kB", "mimeType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "url": "/rest/insight/1.0/attachments/607/1eff0303-80ac-46b9-89d5-89caac7f878c.pdf",
Validate the same in the database AO_8542F1_IFJ_OBJ_ATTACH table. We expect this to be an application/PDF. If it is a different type, for example, application/vnd.openxmlformats-officedocument.wordprocessingml.document, this will cause the issue.
Cause
It may happen when attachments are created using a third-party plugin or any customized functionality.
Solution
Prior to implementing any changes, it is crucial to conduct thorough testing in a test environment. Additionally, remember to create a backup of the data before proceeding with any modifications.
Update the mimeType field in the AO_8542F1_IFJ_OBJ_ATTACH table. The following query is designed for Postgres, so you may need to adjust the syntax for your specific database.
1
update "AO_8542F1_IFJ_OBJ_ATTACH" set "MIME_TYPE" = 'application/pdf' where "NAME_IN_FILE_SYSTEM" LIKE '%pdf';
Was this helpful?