Skip to content

Commit

Permalink
[DUOS-452][risk=no] Fix download links for FF (#204)
Browse files Browse the repository at this point in the history
* fix download links for FF
  • Loading branch information
rushtong authored Sep 17, 2019
1 parent baf5410 commit 99853ce
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 29 deletions.
91 changes: 67 additions & 24 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"classnames": "2.2.6",
"inquirer": "6.5.0",
"jquery": "3.4.0",
"js-file-download": "0.4.8",
"lodash": "4.17.14",
"mixin-deep": "2.0.1",
"popper.js": "1.14.4",
Expand Down
7 changes: 2 additions & 5 deletions src/libs/ajax.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import _ from 'lodash/fp';
import { Config } from './config';
import { spinnerService } from './spinner-service';
import { Storage } from './storage';
import fileDownload from 'js-file-download';

const dataTemplate = {
accessTotal: [
Expand Down Expand Up @@ -1130,11 +1131,7 @@ const getFile = async (URI, fileName) => {
const res = await fetchOk(URI, Config.fileBody());
fileName = fileName === null ? getFileNameFromHttpResponse(res) : fileName;
let blob = await res.blob();
const url = window.URL.createObjectURL(blob);
let a = document.createElement('a');
a.href = url;
a.download = fileName;
a.click();
fileDownload(blob, fileName);
};

const getFileNameFromHttpResponse = (response) => {
Expand Down

0 comments on commit 99853ce

Please sign in to comment.