Skip to content

Commit d09a0b2

Browse files
committed
fix: do not convert u8a to string if it's already a string
1 parent 82cb412 commit d09a0b2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

html5/js/lib/rencode.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,10 @@ function rdecode_string(dec) {
301301
return utf8ByteArrayToString(bytes)
302302
}
303303
function Uint8ToString(u8a){
304+
if (typeof u8a == "string") {
305+
return u8a;
306+
}
307+
304308
const CHUNK_SZ = 0x8000;
305309
const c = [];
306310
for (let i=0; i < u8a.length; i+=CHUNK_SZ) {

0 commit comments

Comments
 (0)