eligrey / eligrey/FileSaver.js

Error when attempting to download static file

Open
#800 1 comment 2 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
22k
Forks
4.3k
PR merge metrics
No merged PRs in 30d

Description

I'm thought I solved my issue using FileSaver, and it was working, but now I'm back to getting the same error.

I have two template files, both of which are .xlsx file types. They are static, and are in the public directory of my react application.

I have a function that is called from clicking a Link component.

The method is as follows:

const downloadTemplate = () => {
try {
var isFileSavedSupported = !!newBlob;
} catch (e) {
enqueueSnackbar('Unsupported brower. Downloading is not permitted', {variant: 'error'});
return;
}
if(!settings.bulkUpload) {
FileSaver.saveAs(process.env.PUBLIC_URL + "/scoping-sheet/ScopingSheet.xlsx", "ScopingSheetTemplate.xlsx", {autoBom: true});
else {
FileSaver.saveAs(process.env.PUBLIC_URL + "/scoping-sheet/Bulk-scoping-sheet.xlsx", "BulkScopingSheetTemplate.xlsx", {autoBom: true});
}}

When attempting to download either of the files using Edge (version 117.0.2045.60) and in Chrome (version 117.0.5938.150), on the download tab of each browser, I receive "Couldn't download - Network Issue" and "Failed - Network Error" respectively.

Any ideas would be appreciated.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.