From 10a19b7c5461b802b768a4d32d8f8026ec53fe37 Mon Sep 17 00:00:00 2001 From: claire bontempo <68122737+hellobontempo@users.noreply.github.com> Date: Tue, 10 May 2022 17:19:38 -0700 Subject: [PATCH] UI/ fix firefox not recognizing csv export (#15364) * add extension to filenmae * add changelog --- changelog/15364.txt | 3 +++ ui/app/services/download-csv.js | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 changelog/15364.txt diff --git a/changelog/15364.txt b/changelog/15364.txt new file mode 100644 index 000000000..e118076f4 --- /dev/null +++ b/changelog/15364.txt @@ -0,0 +1,3 @@ +```release-note:bug +ui: fix firefox inability to recognize file format of client count csv export +``` \ No newline at end of file diff --git a/ui/app/services/download-csv.js b/ui/app/services/download-csv.js index 618aea32b..2dfdecb89 100644 --- a/ui/app/services/download-csv.js +++ b/ui/app/services/download-csv.js @@ -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;