-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Replace regex usage for MIME parsing #17831
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
Conversation
MIME types can have multiple optional parameters, eg: video/webm; codecs="w/e codec"; charset="binary" This commit replaces the usage of regex for getting the "type/subtype" with mime.ParseMediaType.
Codecov Report
@@ Coverage Diff @@
## main #17831 +/- ##
=======================================
Coverage 45.54% 45.54%
=======================================
Files 808 808
Lines 90049 90056 +7
=======================================
+ Hits 41009 41018 +9
+ Misses 42487 42484 -3
- Partials 6553 6554 +1
Continue to review full report at Codecov.
|
Could you add a testcase or two here? Should be pretty simple. |
I tried to think of a regression test for this change but I don't think there is any. Honestly, the only value this PR has is if sometime in the future |
MIME types can have multiple optional parameters, eg: video/webm; codecs="w/e codec"; charset="binary" This commit replaces the usage of regex for getting the "type/subtype" with mime.ParseMediaType.
MIME types can have multiple optional parameters, eg:
video/webm; codecs="w/e codec"; charset="binary"
For these cases, regex will fail to drop all params from the MIME type.
This commit replaces the usage of regex for getting the "type/subtype" with mime.ParseMediaType.