Skip to content

Commit ff48755

Browse files
getParts needs to copy the parts until a better interface can replace this
1 parent 6499438 commit ff48755

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/addon.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ void uWS_getParts(const FunctionCallbackInfo<Value> &args) {
7474

7575
std::string_view part = optionalPart.value();
7676

77-
Local<ArrayBuffer> partArrayBuffer = ArrayBuffer_New(isolate, (void *) part.data(), part.length());
77+
Local<ArrayBuffer> partArrayBuffer = ArrayBuffer_NewCopy(isolate, (void *) part.data(), part.length());
7878
/* Map is 30% faster in this case, but a static Object could be faster still */
7979
Local<Object> partMap = Object::New(isolate);
8080
partMap->Set(isolate->GetCurrentContext(), String::NewFromUtf8(isolate, "data", NewStringType::kNormal).ToLocalChecked(), partArrayBuffer).IsNothing();

0 commit comments

Comments
 (0)