Skip to content

Commit

Permalink
Backport of UI/ fix firefox not recognizing csv export into release/1…
Browse files Browse the repository at this point in the history
….10.x (#15365)

* backport of commit b991ba3

* backport of commit 1112bac

Co-authored-by: Claire Bontempo <[email protected]>
Co-authored-by: claire bontempo <[email protected]>
  • Loading branch information
3 people authored May 12, 2022
1 parent 7d6b802 commit ff09d74
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions changelog/15364.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
ui: fix firefox inability to recognize file format of client count csv export
```
3 changes: 2 additions & 1 deletion ui/app/services/download-csv.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import Service from '@ember/service';

export default class DownloadCsvService extends Service {
download(filename, content) {
let formattedFilename = filename?.replace(/\s+/g, '-') || 'vault-data.csv';
// even though Blob type 'text/csv' is specified below, some browsers (ex. Firefox) require the filename has an explicit extension
let formattedFilename = `${filename?.replace(/\s+/g, '-')}.csv` || 'vault-data.csv';
let { document, URL } = window;
let downloadElement = document.createElement('a');
downloadElement.download = formattedFilename;
Expand Down

0 comments on commit ff09d74

Please sign in to comment.