Uh oh!
There was an error while loading. Please reload this page.
buffer,string_decoder: consolidate encoding validation logic - #7207
buffer,string_decoder: consolidate encoding validation logic#7207jasnell wants to merge 1 commit into
Conversation
mscdex
commented
Jun 7, 2016
I don't think this will work for |
jasnell
commented
Jun 7, 2016
Ok, let me take one more stab at it... |
There was a problem hiding this comment.
Just include it at the top of the file. This is already being required by other modules prior to this point so there's no savings.
jasnell
commented
Jun 7, 2016
@mscdex ... ok, how does that look now? |
There was a problem hiding this comment.
minor nit: this can be simplified to just return;
There was a problem hiding this comment.
Yeah I did it this way just to make it more explicit. Either way works for me tho
LGTM except for minor nit. Should probably run this through citgm though just to be extra safe. |
CI: https://ci.nodejs.org/job/node-test-pull-request/2952/ ... Green except for unrelated build bot failure |
There was a problem hiding this comment.
If we're going to add the comment we may as well just use return undefined; ;-)
There was a problem hiding this comment.
I'd say either
- Prefix the Symbol to help prevent collisions (e.g.
node.isEncoding) - Create and export this symbol from
internal/util.jsso it's no longer global
I lean towards the later.
jasnell
commented
Jun 8, 2016
@trevnorris@mscdex ... updated and added a couple of tests. It turns out that we were not previously testing or verifying that |
trevnorris
commented
Jun 11, 2016
LGTM |
mscdex
commented
Jun 11, 2016
LGTM if CI is still ok: https://ci.nodejs.org/job/node-test-pull-request/2988/ |
That CI run had a couple buildbot issues. Running again just to be safe |
Buffer.isEncoding and string_decoder.normalizeEncoding shared quite a bit of logic. This moves the primary logic into internal/util. The userland modules that monkey patch Buffer.isEncoding should still work.
873a028 to
7b459a9Comparejasnell
commented
Jun 21, 2016
New CI before landing... just in case.. https://ci.nodejs.org/job/node-test-pull-request/3038/ |
Buffer.isEncoding and string_decoder.normalizeEncoding shared quite a bit of logic. This moves the primary logic into internal/util. The userland modules that monkey patch Buffer.isEncoding should still work. PR-URL: #7207 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: Trevor Norris <trev.norris@gmail.com>
jasnell
commented
Jun 21, 2016
Landed in 6dd093d |
thefourtheye
commented
Jun 21, 2016
Returning different types of values from a function could have been avoided :( |
mscdex
commented
Jun 21, 2016
@thefourtheye What do you mean? |
thefourtheye
commented
Jun 21, 2016
@mscdex |
mscdex
commented
Jun 21, 2016
@thefourtheye How could it have been avoided? |
@mscdex maybe we could have returned an empty string instead of |
mscdex
commented
Jun 21, 2016
@thefourtheye Returning |
Fishrock123
commented
Jun 27, 2016
seems to have conflicts on v6 |
jasnell
commented
Jun 27, 2016
@Fishrock123 ... this PR builds on @mscdex's work in #6777. This can be backported to v6 if #6777 is. I don't believe a don't-land label is appropriate but we might need a better way of tracking dependencies between PRs. |
mscdex
commented
Jun 27, 2016
@jasnell That PR is already in v6, it's actually in v6.2.1. |
MylesBorins
commented
Jul 11, 2016
I put the don't land label for v4.x please correct if wrong |
steal a line from nodejs#7207 to make things work
steal a line from nodejs#7207 to make things work PR-URL: nodejs#8437 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
steal a line from nodejs#7207 to make things work PR-URL: nodejs#8437 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Buffer.isEncoding and string_decoder.normalizeEncoding shared quite a bit of logic. This moves the primary logic into internal/util. The userland modules that monkey patch Buffer.isEncoding should still work. PR-URL: nodejs#7207 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Buffer.isEncoding and string_decoder.normalizeEncoding shared quite a bit of logic. This moves the primary logic into internal/util. The userland modules that monkey patch Buffer.isEncoding should still work. PR-URL: #7207 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: Trevor Norris <trev.norris@gmail.com> Refs: #8463 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Due to code consolidation in nodejs#7207 the isEncoding function got less strict. This commit makes sure isEncoding returns false for empty strings as before the consolidation. PR-URL: nodejs#18790 Refs: nodejs#7207 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Due to code consolidation in nodejs#7207 the isEncoding function got less strict. This commit makes sure isEncoding returns false for empty strings as before the consolidation. PR-URL: nodejs#18790 Refs: nodejs#7207 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Checklist
make -j4 test(UNIX) orvcbuild test nosign(Windows) passesAffected core subsystem(s)
buffer, string_decoder
Description of change
Buffer.isEncoding and string_decoder.normalizeEncoding shared
quite a bit of logic. This moves the primary logic into
internal/util. The userland modules that monkey patch Buffer.isEncoding
should still work.
@nodejs/buffer @mscdex