From f8b48121cbbec65344b5d41638868622475e8892 Mon Sep 17 00:00:00 2001 From: Panagiotis Papadopoulos Date: Tue, 6 Dec 2022 14:03:25 +0100 Subject: [PATCH] fix(isMimeType): also match underscores fixes a few valid MIME types not getting matched fixes #2119 --- src/lib/isMimeType.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/isMimeType.js b/src/lib/isMimeType.js index 1dfa77767..4081117af 100644 --- a/src/lib/isMimeType.js +++ b/src/lib/isMimeType.js @@ -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