File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -51,11 +51,16 @@ class RemoteSource extends BaseSource {
5151 }
5252
5353 async fetchSlices ( slices , signal ) {
54+ const end = (
55+ ( this . _fileSize && ( offset + length >= this . _fileSize ) )
56+ ? this . _fileSize - 1
57+ : offset + length
58+ ) ;
5459 const response = await this . client . request ( {
5560 headers : {
5661 ...this . headers ,
5762 Range : `bytes=${ slices
58- . map ( ( { offset, length } ) => `${ offset } -${ offset + length } ` )
63+ . map ( ( { offset, length } ) => `${ offset } -${ end } ` )
5964 . join ( ',' )
6065 } `,
6166 } ,
@@ -108,10 +113,15 @@ class RemoteSource extends BaseSource {
108113
109114 async fetchSlice ( slice , signal ) {
110115 const { offset, length } = slice ;
116+ const end = (
117+ ( this . _fileSize && ( offset + length >= this . _fileSize ) )
118+ ? this . _fileSize - 1
119+ : offset + length
120+ ) ;
111121 const response = await this . client . request ( {
112122 headers : {
113123 ...this . headers ,
114- Range : `bytes=${ offset } -${ offset + length } ` ,
124+ Range : `bytes=${ offset } -${ end } ` ,
115125 } ,
116126 signal,
117127 } ) ;
You can’t perform that action at this time.
0 commit comments