From 0bdf3e31389ef304f80a89bd5be1f14bd5b66fea Mon Sep 17 00:00:00 2001 From: Nick Holden Date: Tue, 3 Oct 2017 18:10:22 -0700 Subject: [PATCH] Fix issue with hyphens in file validation mime types Addresses #646, which reported that mime types in file validations were being parsed incorrectly when they contained hyphens. This change ensures that we only split the allowed file types string at commas and trailing white space and not at hyphens. --- src/modules/file.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/file.js b/src/modules/file.js index 5fdfb83..47e03d6 100644 --- a/src/modules/file.js +++ b/src/modules/file.js @@ -25,7 +25,7 @@ * @return {Array} */ _getTypes = function($input) { - var allowedTypes = $.split( ($input.valAttr('allowing') || '').toLowerCase() ); + var allowedTypes = ($input.valAttr('allowing') || '').toLowerCase().split(/,\s*/); if ($.inArray('jpg', allowedTypes) > -1 && $.inArray('jpeg', allowedTypes) === -1) { allowedTypes.push('jpeg'); }