Skip to content

Commit

Permalink
fix: authentication sourcemap fallback failing for some maps (#1816)
Browse files Browse the repository at this point in the history
Fixes #1814
  • Loading branch information
connor4312 authored Sep 26, 2023
1 parent 47a0837 commit 5c1d581
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/adapter/resourceProvider/statefulResourceProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,12 @@ export class StatefulResourceProvider extends BasicResourceProvider implements I
return original;
}

const chunk = chunkRes.base64Encoded ? Buffer.from(chunkRes.data, 'base64') : chunkRes.data;
offset += chunk.length;
result.push(chunk.toString());
const chunk = chunkRes.base64Encoded
? Buffer.from(chunkRes.data, 'base64').toString()
: chunkRes.data;
// V8 uses byte length, not UTF-16 length, see #1814
offset += Buffer.byteLength(chunk, 'utf-8');
result.push(chunk);
if (offset >= maxOffset) {
this.cdp.IO.close({ handle: res.resource.stream }); // no await: do this in the background
break;
Expand Down

0 comments on commit 5c1d581

Please sign in to comment.