-
-
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
fix(isDataURI): Fix MIME Types with underscores not getting matched #2122
Conversation
preparation for fixing validatorjs#2121
also match valid MIME types with an underscore in their name fixes validatorjs#2121
Codecov ReportBase: 100.00% // Head: 100.00% // No change to project coverage 👍
Additional details and impacted files@@ Coverage Diff @@
## master #2122 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 104 104
Lines 2308 2308
Branches 578 578
=========================================
Hits 2308 2308
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
I was just about to suggest this. I think it would be useful to use |
wouldn't this be more of a "feat" or "refactor" type of PR then, and out of scope of this bugfix PR? I can take a shot at this, but I would like to have this bugfix in first, if that makes sense? |
That indeed makes sense, but I'm not so sure if you want to wait that long. Merging PRs does not happen that often in this library (e.g. look at the last release of over a year ago), so it might be better to combine PRs of the same scope. In this case I would maybe even think about closing this PR and fixing this issue in #2120. That way it also makes more sense to use |
I guess I'm a stickler for keeping PRs minimal and discrete, so I would intuitively be skeptical of @WikiRik's approach. It's a shame that it feels necessary, though. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank!
Fix isDataURI returning
false
for perfectly valid strings, more info can be found here: #2121I've added an additional test case with a MIME type that has an underscore in its name and added the
_
(underscore) to the RegExp to match for these cases.This fixes #2121
(on a side note here: I feel like isDataURI could or maybe even should be rewritten to internally use isMimeType and isBase64 -> that way you would get rid of some code duplication - but that is a completely different topic than this quick bug fix).
Checklist
[ ] README updated (where applicable)