Skip to content

Commit 7dce93f

Browse files
authored
Merge pull request #297 from HIP-infrastructure/fix/type-mismatch
fix: do not convert u8a to string if it's already a string
2 parents 82cb412 + d09a0b2 commit 7dce93f

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)