Skip to content

Commit

Permalink
fix: do not convert u8a to string if it's already a string
Browse files Browse the repository at this point in the history
  • Loading branch information
iDmple committed Mar 25, 2024
1 parent 82cb412 commit d09a0b2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions html5/js/lib/rencode.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,10 @@ function rdecode_string(dec) {
return utf8ByteArrayToString(bytes)
}
function Uint8ToString(u8a){
if (typeof u8a == "string") {
return u8a;
}

const CHUNK_SZ = 0x8000;
const c = [];
for (let i=0; i < u8a.length; i+=CHUNK_SZ) {
Expand Down

0 comments on commit d09a0b2

Please sign in to comment.