diff options
Diffstat (limited to 'src/bun.js/bindings/JSBuffer.cpp')
-rw-r--r-- | src/bun.js/bindings/JSBuffer.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/bun.js/bindings/JSBuffer.cpp b/src/bun.js/bindings/JSBuffer.cpp index ebaec3def..623c67bcb 100644 --- a/src/bun.js/bindings/JSBuffer.cpp +++ b/src/bun.js/bindings/JSBuffer.cpp @@ -1147,6 +1147,11 @@ static inline JSC::EncodedJSValue jsBufferPrototypeFunction_toStringBody(JSC::JS case 3: case 1: { JSC::JSValue arg1 = callFrame->uncheckedArgument(0); + if (arg1.isUndefined()) { + encoding = WebCore::BufferEncodingType::utf8; + break; + } + std::optional<BufferEncodingType> encoded = parseEnumeration<BufferEncodingType>(*lexicalGlobalObject, arg1); if (!encoded) { throwTypeError(lexicalGlobalObject, scope, "Invalid encoding"_s); |