Details
-
Bug
-
Resolution: Fixed
-
Medium
-
2.10.2, 3.0.2
Description
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; }