Skip to content

Commit

Permalink
fix(isMimeType): also match underscores
Browse files Browse the repository at this point in the history
fixes a few valid MIME types not getting matched

fixes validatorjs#2119
  • Loading branch information
pano9000 committed Dec 6, 2022
1 parent 2416523 commit f8b4812
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/isMimeType.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import assertString from './util/assertString';
// NB :
// Subtype length must not exceed 100 characters.
// This rule does not comply to the RFC specs (what is the max length ?).
const mimeTypeSimple = /^(application|audio|font|image|message|model|multipart|text|video)\/[a-zA-Z0-9\.\-\+]{1,100}$/i; // eslint-disable-line max-len
const mimeTypeSimple = /^(application|audio|font|image|message|model|multipart|text|video)\/[a-zA-Z0-9\.\-\+_]{1,100}$/i; // eslint-disable-line max-len

// Handle "charset" in "text/*"
const mimeTypeText = /^text\/[a-zA-Z0-9\.\-\+]{1,100};\s?charset=("[a-zA-Z0-9\.\-\+\s]{0,70}"|[a-zA-Z0-9\.\-\+]{0,70})(\s?\([a-zA-Z0-9\.\-\+\s]{1,20}\))?$/i; // eslint-disable-line max-len
Expand Down

0 comments on commit f8b4812

Please sign in to comment.