From 746eacf69ecd4da8e72df72c21a49e25ff784dbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Fri, 30 Aug 2019 16:28:09 +0200 Subject: [PATCH 1/2] Allow to set mimetype for downloads --- gsa/src/web/components/form/download.js | 4 ++-- gsa/src/web/components/form/withDownload.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gsa/src/web/components/form/download.js b/gsa/src/web/components/form/download.js index 5141168815..0afbc6700a 100644 --- a/gsa/src/web/components/form/download.js +++ b/gsa/src/web/components/form/download.js @@ -38,8 +38,8 @@ class Download extends React.Component { this.anchor.download = name; } - setData(data) { - const blob = new Blob([data], {type: 'application/octet-stream'}); + setData(data, mimetype = 'application/octet-stream') { + const blob = new Blob([data], {type: mimetype}); this.release(); diff --git a/gsa/src/web/components/form/withDownload.js b/gsa/src/web/components/form/withDownload.js index a9cfcf9971..44b6aaafec 100644 --- a/gsa/src/web/components/form/withDownload.js +++ b/gsa/src/web/components/form/withDownload.js @@ -28,9 +28,9 @@ const withDownload = Component => { this.handleDownload = this.handleDownload.bind(this); } - handleDownload({filename, data}) { + handleDownload({filename, data, mimetype}) { this.download.setFilename(filename); - this.download.setData(data); + this.download.setData(data, mimetype); this.download.download(); } From 99e4e6cb944cdfc367854355f97b80e991541a74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ricks?= Date: Fri, 30 Aug 2019 16:28:29 +0200 Subject: [PATCH 2/2] Set mimetype for certificate download With this change the cert is get the .pem extension in chrome too. --- gsa/src/web/pages/reports/detailspage.js | 1 + 1 file changed, 1 insertion(+) diff --git a/gsa/src/web/pages/reports/detailspage.js b/gsa/src/web/pages/reports/detailspage.js index 54c500799c..1c13ef0ffc 100644 --- a/gsa/src/web/pages/reports/detailspage.js +++ b/gsa/src/web/pages/reports/detailspage.js @@ -495,6 +495,7 @@ class ReportDetails extends React.Component { onDownload({ filename: 'tls-cert-' + serial + '.pem', + mimetype: 'application/x-x509-ca-cert', data: create_pem_certificate(data), }); }