Merge pull request #326 from nsacyber/issue-324

[#324]  Update filenames when downloading (RIM)
This commit is contained in:
Cyrus 2021-01-05 11:12:25 -05:00 committed by GitHub
commit c181665ad9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -339,19 +339,7 @@ public class ReferenceManifestPageController
response.sendError(HttpServletResponse.SC_NOT_FOUND);
} else {
StringBuilder fileName = new StringBuilder("filename=\"");
if (referenceManifest.getRimType().equals(ReferenceManifest.BASE_RIM)) {
BaseReferenceManifest bRim = (BaseReferenceManifest) referenceManifest;
fileName.append(bRim.getSwidName());
fileName.append("_[");
fileName.append(referenceManifest.getRimHash());
fileName.append("]");
fileName.append(".swidTag\"");
} else {
// this needs to be updated for support rims
SupportReferenceManifest bRim = (SupportReferenceManifest) referenceManifest;
fileName.append(bRim.getFileName());
}
fileName.append(referenceManifest.getFileName());
// Set filename for download.
response.setHeader("Content-Disposition", "attachment;" + fileName);
response.setContentType("application/octet-stream");