]> git.p6c8.net - jirafeau/jirafeau.git/blobdiff - lib/functions.js.php
Ignore trailing dots and whitespace when checking file extension
[jirafeau/jirafeau.git] / lib / functions.js.php
index 656108b7cb69809a41aa34b6f800f115203d5450..9307eda582a2fd8e899563cb2331e42797a39a3b 100644 (file)
@@ -356,7 +356,7 @@ function control_selected_file_size(max_size, error_str)
 // just warns the user before they submit a doomed upload.
 function control_selected_file_extension(disallowed_extensions, error_str)
 {
-    f_name = document.getElementById('file_select').files[0].name;
+    f_name = document.getElementById('file_select').files[0].name.replace(/[\s.]+$/, '');
     f_ext = f_name.includes('.') ? f_name.split('.').pop().toLowerCase() : '';
     if (disallowed_extensions.includes(f_ext))
     {

patrick-canterino.de