Skip to content

Commit

Permalink
Merge pull request #1598 from bjoernricks/allow-to-set-download-mimetype
Browse files Browse the repository at this point in the history
Allow to set download mimetype
  • Loading branch information
swaterkamp authored Aug 30, 2019
2 parents 4630f88 + 99e4e6c commit ae2c87d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions gsa/src/web/components/form/download.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
4 changes: 2 additions & 2 deletions gsa/src/web/components/form/withDownload.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
1 change: 1 addition & 0 deletions gsa/src/web/pages/reports/detailspage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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),
});
}
Expand Down

0 comments on commit ae2c87d

Please sign in to comment.