aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Ai Hoshino <ambiguous404@gmail.com> 2023-09-12 08:27:12 +0800
committerGravatar GitHub <noreply@github.com> 2023-09-11 17:27:12 -0700
commitc4507a5db33910258278bd6641dcbe34ab33628e (patch)
tree4a2ea5b4e27ff4be9a24284a1ed8b18eee01a3e9 /src
parentc9a0ea96cd13df39fdfc4c1ebb897453517718f3 (diff)
downloadbun-c4507a5db33910258278bd6641dcbe34ab33628e.tar.gz
bun-c4507a5db33910258278bd6641dcbe34ab33628e.tar.zst
bun-c4507a5db33910258278bd6641dcbe34ab33628e.zip
Fix `Buffer.from` to handle double-byte hex encoding strings (#4933)
Close: #4919
Diffstat (limited to 'src')
-rw-r--r--src/bun.js/bindings/JSBuffer.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/bun.js/bindings/JSBuffer.cpp b/src/bun.js/bindings/JSBuffer.cpp
index ad901b0e4..9227e47b3 100644
--- a/src/bun.js/bindings/JSBuffer.cpp
+++ b/src/bun.js/bindings/JSBuffer.cpp
@@ -351,6 +351,7 @@ static EncodedJSValue constructFromEncoding(JSGlobalObject* lexicalGlobalObject,
case WebCore::BufferEncodingType::utf8:
case WebCore::BufferEncodingType::base64:
case WebCore::BufferEncodingType::base64url:
+ case WebCore::BufferEncodingType::hex:
case WebCore::BufferEncodingType::ascii:
case WebCore::BufferEncodingType::latin1: {
result = Bun__encoding__constructFromUTF16(lexicalGlobalObject, view.characters16(), view.length(), static_cast<uint8_t>(encoding));