From 65b87ef0201408c9d952e875852185e371995ba1 Mon Sep 17 00:00:00 2001 From: Phil Dominguez <142051477+phildominguez-gsa@users.noreply.github.com> Date: Tue, 20 Feb 2024 09:21:40 -0500 Subject: [PATCH] Accepting capitalized file extensions in the frontend (#3421) * Accepting capitalized file extensions * Lowercasing string for extension check --- backend/audit/templates/audit/upload-report.html | 2 +- .../templates/report_submission/upload-page.html | 2 +- backend/static/js/upload-page.js | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/backend/audit/templates/audit/upload-report.html b/backend/audit/templates/audit/upload-report.html index 0b7c2c8dcf..0fa69d6bf9 100644 --- a/backend/audit/templates/audit/upload-report.html +++ b/backend/audit/templates/audit/upload-report.html @@ -78,7 +78,7 @@

{% if already_submitted %}Re-upload{% else id="upload_report" id_test="upload-report__file-input" name="upload_report" - accept=".pdf" + accept=".pdf,.PDF" aria-describedby="file_input_upload_report" required type="file" /> diff --git a/backend/report_submission/templates/report_submission/upload-page.html b/backend/report_submission/templates/report_submission/upload-page.html index 77ef4da896..6dbaf0e241 100644 --- a/backend/report_submission/templates/report_submission/upload-page.html +++ b/backend/report_submission/templates/report_submission/upload-page.html @@ -40,7 +40,7 @@

Upload completed worksheet + accept=".xlsx,.XLSX" /> {% if already_submitted %} diff --git a/backend/static/js/upload-page.js b/backend/static/js/upload-page.js index 4254f6faa9..1e0d164e21 100644 --- a/backend/static/js/upload-page.js +++ b/backend/static/js/upload-page.js @@ -10,7 +10,7 @@ const already_submitted = document.getElementById(`already-submitted`); // Boole const file_input = document.getElementById(`file-input-${view_id}-xlsx`); // const info_box = document.getElementById(`info_box`); //
-/* +/* Function definitions */ // Disable/enable "Continue" button @@ -80,7 +80,7 @@ function display_error_table(data) { // Link } - const validationTable = `

Error on validation. Check the following cells for errors, and re-upload. + const validationTable = `

Error on validation. Check the following cells for errors, and re-upload. Common errors include incorrect data types or missing information.

@@ -111,7 +111,7 @@ function attachFileUploadHandler() { UPLOAD_URLS[current_url.pathname.split('/')[2]]; if (!report_submission_url) throw 'No upload URL available.'; if (!e.target.files[0]) throw 'No file selected.'; - if (e.target.files[0].name.split('.').pop() !== 'xlsx') + if (e.target.files[0].name.split('.').pop().toLowerCase() !== 'xlsx') throw 'File type not accepted.'; var body = new FormData();