From: TehPeGaSuS <25697531+TehPeGaSuS@users.noreply.github.com> Date: Sun, 25 Oct 2026 23:19:25 +0000 (+0100) Subject: Use braces on every if in control_selected_file_extension X-Git-Tag: 4.8.0~11^2 X-Git-Url: https://git.p6c8.net/jirafeau/jirafeau.git/commitdiff_plain/03ed5327384d8fb6f25fc60f6f4e249458f15c8a?ds=sidebyside Use braces on every if in control_selected_file_extension --- diff --git a/lib/functions.js.php b/lib/functions.js.php index 355cbe7..c468d18 100644 --- a/lib/functions.js.php +++ b/lib/functions.js.php @@ -357,7 +357,9 @@ function control_selected_file_size(max_size, error_str) function control_selected_file_extension(disallowed_extensions, error_str) { if (disallowed_extensions.length === 0) + { return; + } f_name = document.getElementById('file_select').files[0].name.replace(/[\s.]+$/, '').toLowerCase(); // suffix match so that compound extensions such as 'tar.gz' work too if (disallowed_extensions.some(function (ext) { return f_name.endsWith('.' + ext); })) @@ -365,16 +367,22 @@ function control_selected_file_extension(disallowed_extensions, error_str) // control_selected_file_size runs first: keep its error, if any, and add ours var error_pop = document.getElementById('error_pop'); if (error_pop.style.display === 'none') + { pop_failure(error_str); + } else + { error_pop.innerHTML += '
' + error_str; + } // keep the button visible but disabled so the user sees it is forbidden document.getElementById('send').style.display = 'block'; document.getElementById('send').disabled = true; document.getElementById('disallowed_extensions').style.display = 'block'; } else + { document.getElementById('disallowed_extensions').style.display = 'none'; + } } function XHRErrorHandler(e)