Skip to content

Commit 0fa6c4a

Browse files
committed
string_decoder: don't cache Buffer.isEncoding
Some modules are monkey-patching Buffer.isEncoding, so without this they cannot do that. Fixes: #1547 PR-URL: #1548 Reviewed-By: Evan Lucas <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]>
1 parent e55fdc4 commit 0fa6c4a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/string_decoder.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
'use strict';
22

3-
const isEncoding = Buffer.isEncoding;
4-
53
function assertEncoding(encoding) {
6-
if (encoding && !isEncoding(encoding)) {
4+
// Do not cache `Buffer.isEncoding`, some modules monkey-patch it to support
5+
// additional encodings
6+
if (encoding && !Buffer.isEncoding(encoding)) {
77
throw new Error('Unknown encoding: ' + encoding);
88
}
99
}

0 commit comments

Comments
 (0)