Skip to content

Commit 0bdf3e3

Browse files
author
Nick Holden
committed
Fix issue with hyphens in file validation mime types
Addresses victorjonsson#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.
1 parent 18150ec commit 0bdf3e3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/modules/file.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
* @return {Array}
2626
*/
2727
_getTypes = function($input) {
28-
var allowedTypes = $.split( ($input.valAttr('allowing') || '').toLowerCase() );
28+
var allowedTypes = ($input.valAttr('allowing') || '').toLowerCase().split(/,\s*/);
2929
if ($.inArray('jpg', allowedTypes) > -1 && $.inArray('jpeg', allowedTypes) === -1) {
3030
allowedTypes.push('jpeg');
3131
}

0 commit comments

Comments
 (0)