Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI/ fix firefox not recognizing csv export #15364

Merged
merged 2 commits into from
May 11, 2022
Merged

Conversation

hellobontempo
Copy link
Contributor

Without the explicit .csv extension in the filename, Firefox doesn't recognize the download file type.

@hellobontempo hellobontempo added ui bug Used to indicate a potential bug backport/1.10.x labels May 10, 2022
@hellobontempo hellobontempo added this to the 1.10.3 milestone May 10, 2022
@@ -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';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: filename param passed is without any extension right?

Copy link
Contributor Author

@hellobontempo hellobontempo May 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question! That's correct, it's generated in the attribution component. I thought it'd simplify things to have the service take care of all csv/download related things.

 get getCsvFileName() {
    let endRange = this.isDateRange ? `-${this.args.endTimeDisplay}` : '';
    let csvDateRange = this.args.startTimeDisplay + endRange;
    return this.isSingleNamespace
      ? `clients_by_auth_method_${csvDateRange}`
      : `clients_by_namespace_${csvDateRange}`;
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Used to indicate a potential bug ui
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants