Skip to content

Commit

Permalink
Run prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
kidroca committed Nov 1, 2023
1 parent 0060380 commit 2db8172
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/libs/fileDownload/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as ApiUtils from '@libs/ApiUtils';
import tryResolveUrlFromApiRoot from '@libs/tryResolveUrlFromApiRoot';
import * as Link from '@userActions/Link';
import * as ApiUtils from '../ApiUtils';
import * as FileUtils from './FileUtils';
import tryResolveUrlFromApiRoot from '../tryResolveUrlFromApiRoot';

/**
* Downloading attachment in web, desktop
Expand All @@ -18,7 +18,8 @@ export default function fileDownload(url, fileName) {
return Promise.resolve();
}

return fetch(url)
return (
fetch(url)
.then((response) => response.blob())
.then((blob) => {
// Create blob link to download
Expand Down Expand Up @@ -46,5 +47,6 @@ export default function fileDownload(url, fileName) {
link.parentNode.removeChild(link);
})
// file could not be downloaded, open sourceURL in new tab
.catch(() => Link.openExternalLink(url));
.catch(() => Link.openExternalLink(url))
);
}

0 comments on commit 2db8172

Please sign in to comment.