File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
src/adapter/resourceProvider Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -99,9 +99,12 @@ export class StatefulResourceProvider extends BasicResourceProvider implements I
99
99
return original ;
100
100
}
101
101
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 ) ;
105
108
if ( offset >= maxOffset ) {
106
109
this . cdp . IO . close ( { handle : res . resource . stream } ) ; // no await: do this in the background
107
110
break ;
You can’t perform that action at this time.
0 commit comments