File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -137,7 +137,7 @@ describe("XetBlob", () => {
137
137
expect ( new Uint8Array ( xetDownload ) ) . toEqual ( new Uint8Array ( bridgeDownload ) ) ;
138
138
} , 30_000 ) ;
139
139
140
- it ( "should load text correctly when offset_into_range starts in a chunk further than the first" , async ( ) => {
140
+ it . only ( "should load text correctly when offset_into_range starts in a chunk further than the first" , async ( ) => {
141
141
const blob = new XetBlob ( {
142
142
repo : {
143
143
type : "model" ,
Original file line number Diff line number Diff line change @@ -217,7 +217,7 @@ export class XetBlob extends Blob {
217
217
const termRanges = rangeList . getRanges ( term . range . start , term . range . end ) ;
218
218
219
219
if ( termRanges . every ( ( range ) => range . data ) ) {
220
- for ( const range of termRanges ) {
220
+ rangeLoop: for ( const range of termRanges ) {
221
221
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
222
222
for ( let chunk of range . data ! ) {
223
223
if ( chunk . length > maxBytes - totalBytesRead ) {
@@ -227,6 +227,10 @@ export class XetBlob extends Blob {
227
227
// The stream consumer can decide to transfer ownership of the chunk, so we need to return a clone
228
228
// if there's more than one range for the same term
229
229
yield range . refCount > 1 ? chunk . slice ( ) : chunk ;
230
+
231
+ if ( totalBytesRead >= maxBytes ) {
232
+ break rangeLoop;
233
+ }
230
234
}
231
235
}
232
236
rangeList . remove ( term . range . start , term . range . end ) ;
You can’t perform that action at this time.
0 commit comments