How to disable preview for any attached document in Confluence
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
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
Confluence version above 7.2 does not allows to disable preview of attachments from UI.
If you have any specific reason where you don't want users to preview the file rather download the file, then the steps mentioned in this KB would be helpful.
Solution
- Go to the Confluence administration -> manage add ons -> show system add ons
- Search for Confluence Previews and note the app key, mostly the app key should be com.atlassian.confluence.plugins.confluence-previews ( screenshot below )
- Log into DB and run the below query :
select BANDANAVALUE from BANDANA where BANDANAKEY = 'plugin.manager.state.Map';
- The results would be a long list for example below :
- Copy the complete list in a notepad and add the preview plugin key at the end of the file having the boolean value set to false just before /map.
<entry>
<string>com.atlassian.confluence.plugins.confluence-previews</string>
<boolean>false</boolean>
</entry>
- The complete set would be like below after adding the preview key:
<map>
<entry>
<string>com.atlassian.confluence.plugins.confluence-inline-tasks:task-email-notification-template-body</string>
<boolean>true</boolean>
</entry>
<entry>
<string>com.atlassian.confluence.plugins.confluence-content-notifications-plugin:blogpost-trashed-notification-template-body</string>
<boolean>true</boolean>
</entry>
<entry>
<string>com.atlassian.confluence.plugins.confluence-content-notifications-plugin:comment-created-notification-template-body</string>
<boolean>true</boolean>
</entry>
<entry>
<string>com.atlassian.confluence.plugins.confluence-content-notifications-plugin:page-trashed-notification-template-body</string>
<boolean>true</boolean>
</entry>
<entry>
<string>com.atlassian.confluence.plugins.confluence-content-notifications-plugin:blogpost-edited-hipchat-notification-template-body</string>
<boolean>true</boolean>
</entry>
<entry>
<string>com.atlassian.confluence.plugins.confluence-content-notifications-plugin:page-edited-hipchat-notification-template-body</string>
<boolean>true</boolean>
</entry>
<entry>
<string>com.atlassian.confluence.plugins.confluence-previews</string>
<boolean>false</boolean>
</entry>
</map>
Next is to update the DB with the complete above set where you need to copy the complete data from your notepad and then run the below update query:
update BANDANA set BANDANAVALUE = 'copy the entire text from <map> to </map>' where BANDANAKEY='plugin.manager.state.Map';
- Once the table is updated, double check by running the select query to see if the table has been updated with the new data.
- Stop and Start Confluence
- After Confluence comes up, you can see in manage add ons that Confluence Preview plugin is disabled.
- Test now with any excel or pdf file in Confluence and you should see that Preview of the file will not be happening and the file will directly download.