Closed
Description
Description of the problem
The isDataURI function is used to check a Data URI in base64, including the MediaType, Attribute and Data.
The regular expression validating the MediaType is the following:
/^[a-z]+\/[a-z0-9\-\+]+$/i;
However, the latter does not include the "." character which is sometimes present in MediaType, for example in the MIME of Excels files:
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
Proposed solution
To correct this problem, we would have to correct this regular expression to include the dot, here is a proposed solution that works for my use case:
/^[a-z]+\/[a-z0-9\-\+\.]+$/i
It is then enough to modify the code of the file "\node_modules\validator\lib\isDataURI.js" as follows:
validMediaType = /^[a-z]+\/[a-z0-9\-\+\.]+$/i;
Additional context
Validator.js version: v13.7.0
Node.js version: v16.13.1