mirror of
https://github.com/nodejs/node.git
synced 2026-11-25 23:01:06 -05:00
buffer: make decodeUTF8 params loose
PR-URL: https://github.com/nodejs/node/pull/45610 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Darshan Sen <raisinten@gmail.com>
This commit is contained in:
1 parent
e2da381609
commit
bfcf4f0046
1 file changed
+2
-1
+2
-1
@@ -570,6 +570,8 @@ void StringSlice(const FunctionCallbackInfo<Value>& args) {
|
||||
void DecodeUTF8(const FunctionCallbackInfo<Value>& args) {
|
||||
Environment* env = Environment::GetCurrent(args); // list, flags
|
||||
|
||||
CHECK_GE(args.Length(), 1);
|
||||
|
||||
if (!(args[0]->IsArrayBuffer() || args[0]->IsSharedArrayBuffer() ||
|
||||
args[0]->IsArrayBufferView())) {
|
||||
return node::THROW_ERR_INVALID_ARG_TYPE(
|
||||
@@ -580,7 +582,6 @@ void DecodeUTF8(const FunctionCallbackInfo<Value>& args) {
|
||||
|
||||
ArrayBufferViewContents<char> buffer(args[0]);
|
||||
|
||||
CHECK(args[1]->IsBoolean());
|
||||
bool ignore_bom = args[1]->IsTrue();
|
||||
|
||||
const char* data = buffer.data();
|
||||
|
||||
Reference in new issue
Block a user