Skip to content
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: Properly parse meta tag when parameters are reversed #682

Merged

Conversation

@dsuket
Copy link
Contributor

@dsuket dsuket commented Oct 7, 2019

convertBodyfunction work fine when html has this meta tag.
<meta http-equiv="content-type" content="text/html;charset=shift_jis">

However, if the http-equiv attribute is reversed like this, it will not work.
<meta content="text/html; charset=Shift_JIS" http-equiv="Content-Type" />

dsuket added 2 commits Oct 7, 2019
dsuket
fix convertBody for reverse http-equiv
@codecov-io
Copy link

@codecov-io codecov-io commented Oct 7, 2019

Codecov Report

Merging #682 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #682   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           7      7           
  Lines         575    579    +4     
  Branches      183    185    +2     
=====================================
+ Hits          575    579    +4
Impacted Files Coverage Δ
src/body.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 47a24a0...530a689. Read the comment docs.

@Richienb
Copy link
Member

@Richienb Richienb commented Oct 7, 2019

In v3, we are going to be replacing the regex system with an actual parser in Richienb/fetch-charset-detection/src/index.ts#L53 but we can still use this as a band-aid patch if we do eventually make a final release for v2.

I'm adding some unit tests now.

dsuket
@dsuket
Copy link
Contributor Author

@dsuket dsuket commented Oct 7, 2019

@Richienb Thank you for your reply.
Added test. I'm sorry if it's misplaced.

@Richienb Richienb changed the title fix convertBody for reverse 'http-equiv' fix: Properly parse meta tag when parameters are reversed Oct 7, 2019
@Richienb Richienb merged commit 6a5d192 into node-fetch:master Oct 7, 2019
3 checks passed
3 checks passed
codecov/patch 100% of diff hit (target 100%)
Details
codecov/project 100% (+0%) compared to 47a24a0
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
isaacs added a commit to npm/minipass-fetch that referenced this pull request Oct 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.