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

Correct handling of 'Content-Length' header by using Buffer.byteLength #10055

Conversation

denisse-dev
Copy link
Contributor

Closes #10041

  1. Why is this change neccesary?
    String.prototype.length returns the number of code units in the string (number
    of characters) while Buffer.byteLength returns the actual byute length of a
    string.

  2. How does it address the issue?
    Places that use String.prototype.length to calculate Content-Length
    were switched to Buffer.byteLength instead.

  • ✅ There's a clear use-case for this code change
  • ✅ Commit message has a short title & references relevant issues
  • ✅ The build will pass (run npm test)

Closes TryGhost#10041
1. Why is this change neccesary?
String.prototype.length returns the number of code units in the string (number
of characters) while Buffer.byteLength returns the actual byute length of a
string.

2. How does it address the issue?
Places that use String.prototype.length to calculate Content-Length
were switched to Buffer.byteLength instead.
@allouis allouis merged commit 3f91a9e into TryGhost:master Oct 25, 2018
@allouis
Copy link
Contributor

allouis commented Oct 25, 2018

Thanks @da-edra 🎉

@denisse-dev denisse-dev deleted the feature/correct-handling-of-content-length branch October 25, 2018 16:29
allouis added a commit that referenced this pull request Oct 30, 2018
* master:
  Version bump to 2.4.0
  Updated Ghost-Admin to 2.4.0
  Handled error from express-session middleware (#10084)
  Removed user_id constraint when upserting session (#10085)
  Added Node v10 Support (#10058)
  Removed logic for migration script (2.0/6-replace-fixture-posts.js) (#10081)
  Fixed sanitization issue in subscribers
  Parsed nconf env values (#10077)
  🐛 Fixed missing filename when exporting subscribers csv
  🐛 Fixed pagination for subscribers
  🐛 Fixed cardWidth being lost on 2.0 imports (#10068)
  Corrected 'Content-Length' header by using Buffer.byteLength (#10055)
  Fixed mail api usage of the notifcations api
  Refactored request unit tests to return promises (#10045)
  Refactored spam prevention tests to use promises (#10036)
  Enforced unix line endings (#9871)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants