-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incomplete validation of the MediaType in isDataURI function #1972
Labels
Comments
Can i work on this? |
For sure! |
I am working on this issue. Will be raising a PR soon. |
Hi all, this has been fixed with PR #1916 already, which has been merged into master since April. |
Thank you all for your contribution and for the fix ! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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:
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:
It is then enough to modify the code of the file "\node_modules\validator\lib\isDataURI.js" as follows:
Additional context
Validator.js version: v13.7.0
Node.js version: v16.13.1
The text was updated successfully, but these errors were encountered: