diff options
author | Matt Strapp <matt@mattstrapp.net> | 2022-02-24 15:04:48 -0600 |
---|---|---|
committer | Matt Strapp <matt@mattstrapp.net> | 2022-02-24 15:04:48 -0600 |
commit | c739cf9923184e929b46242559b93fb121baf521 (patch) | |
tree | b018d93795333134ff44449fc1b34ce4a8f89988 /src/public | |
parent | Bump @types/node from 17.0.19 to 17.0.20 (#12) (diff) | |
download | ee4511w-web-c739cf9923184e929b46242559b93fb121baf521.tar ee4511w-web-c739cf9923184e929b46242559b93fb121baf521.tar.gz ee4511w-web-c739cf9923184e929b46242559b93fb121baf521.tar.bz2 ee4511w-web-c739cf9923184e929b46242559b93fb121baf521.tar.lz ee4511w-web-c739cf9923184e929b46242559b93fb121baf521.tar.xz ee4511w-web-c739cf9923184e929b46242559b93fb121baf521.tar.zst ee4511w-web-c739cf9923184e929b46242559b93fb121baf521.zip |
Fix bug with windows not uploading the right mimetype
Signed-off-by: Matt Strapp <matt@mattstrapp.net>
Diffstat (limited to 'src/public')
-rw-r--r-- | src/public/js/form.js | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/public/js/form.js b/src/public/js/form.js index 3fbeb50..724fb05 100644 --- a/src/public/js/form.js +++ b/src/public/js/form.js @@ -3,7 +3,7 @@ window.onload = function () { document.getElementById('nojs').hidden = true; document.getElementById('block').hidden = false; -}; +}; // File submit AJAX request // After successful upload, actuate the file by calling actuate() on the successfully uploaded file @@ -54,24 +54,24 @@ function actuate(file) { xhr.onreadystatechange = function () { if (xhr.readyState === 4) { let response = JSON.parse(xhr.responseText); - if (xhr.status === 200) { - console.log(response); + if (xhr.status === 200 || xhr.status === 500) { createDownload(response.file); - } else { - // Display upload error message to the user - document.getElementById('actuate-err').innerText = response.error; - // DEBUG: Print full error if unknown error occurs - if (xhr.status === 500) - console.error(response.error_msg); } - return; + // Display upload error message to the user + document.getElementById('actuate-err').innerText = response.error; + // DEBUG: Print full error if unknown error occurs + if (xhr.status === 500) + console.error(response.error_msg); } + return; }; } // Creates the download element function createDownload(response) { + if (!response) + return; const tempName = response.filename; const downloadName = response.name.split('.')[ 0 ]; const downloadLink = document.createElement('a'); |