-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Medium
-
Affects Version/s: 2.10.2, 3.0.2
-
Component/s: Page - Export / Import
For all types of download content always have "application/x-download" content type in header.
For PDF should be "application/pdf".
The easiest way to fix is to add parameter to download url in ExportPageAction:
- is:
private String prepareDownloadPath(String path) throws IOException { String homeDir = new File(getBootstrapManager().getConfluenceHome()).getCanonicalPath(); String canonicalPath = new File(path).getCanonicalPath(); int homeDirIndex = canonicalPath.indexOf(homeDir); if (homeDirIndex != -1) { path = canonicalPath.substring(homeDirIndex + homeDir.length() + 1); } return "/download/" + path; } - should be:
private String prepareDownloadPath(String path) throws IOException { String homeDir = new File(getBootstrapManager().getConfluenceHome()).getCanonicalPath(); String canonicalPath = new File(path).getCanonicalPath(); int homeDirIndex = canonicalPath.indexOf(homeDir); if (homeDirIndex != -1) { path = canonicalPath.substring(homeDirIndex + homeDir.length() + 1); } path = "/download/" + path; if(ImportExportManager.TYPE_PDF.equals(type)){ path += "?contentType=application/pdf"; } //...more types here return path; }