Skip to content

Commit 5c1d581

Browse files
authored
fix: authentication sourcemap fallback failing for some maps (#1816)
Fixes #1814
1 parent 47a0837 commit 5c1d581

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/adapter/resourceProvider/statefulResourceProvider.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,12 @@ export class StatefulResourceProvider extends BasicResourceProvider implements I
9999
return original;
100100
}
101101

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

0 commit comments

Comments
 (0)