Skip to content

Commit

Permalink
Accepting capitalized file extensions in the frontend (#3421)
Browse files Browse the repository at this point in the history
* Accepting capitalized file extensions

* Lowercasing string for extension check
  • Loading branch information
phildominguez-gsa authored Feb 20, 2024
1 parent 088b45e commit 65b87ef
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion backend/audit/templates/audit/upload-report.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ <h4 class="usa-process-list__heading">{% 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" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ <h4 class="usa-process-list__heading margin-top-4">Upload completed worksheet</h
type="file"
name="file-input-{{ view_id }}-xlsx"
aria-describedby="file-input-{{ view_id }}-xlsx"
accept=".xlsx" />
accept=".xlsx,.XLSX" />
</div>

{% if already_submitted %}
Expand Down
6 changes: 3 additions & 3 deletions backend/static/js/upload-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const already_submitted = document.getElementById(`already-submitted`); // Boole
const file_input = document.getElementById(`file-input-${view_id}-xlsx`); // <input type="file">
const info_box = document.getElementById(`info_box`); // <div>

/*
/*
Function definitions
*/
// Disable/enable "Continue" button
Expand Down Expand Up @@ -80,7 +80,7 @@ function display_error_table(data) {
// <a class="usa-link" href="${row_array[3]["link"]}">Link</a>
}

const validationTable = `<p>Error on validation. Check the following cells for errors, and re-upload.
const validationTable = `<p>Error on validation. Check the following cells for errors, and re-upload.
Common errors include incorrect data types or missing information.</p>
<table class="usa-table usa-table--striped">
<thead>
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 65b87ef

Please sign in to comment.