File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,15 @@ class RemoteSource extends BaseSource {
5555 headers : {
5656 ...this . headers ,
5757 Range : `bytes=${ slices
58- . map ( ( { offset, length } ) => `${ offset } -${ offset + length } ` )
58+ . map ( ( { offset, length } ) => {
59+ const end = (
60+ ( this . _fileSize && ( offset + length >= this . _fileSize ) )
61+ ? this . _fileSize - 1
62+ : offset + length
63+ ) ;
64+
65+ return `${ offset } -${ end } ` ;
66+ } )
5967 . join ( ',' )
6068 } `,
6169 } ,
@@ -108,10 +116,15 @@ class RemoteSource extends BaseSource {
108116
109117 async fetchSlice ( slice , signal ) {
110118 const { offset, length } = slice ;
119+ const end = (
120+ ( this . _fileSize && ( offset + length >= this . _fileSize ) )
121+ ? this . _fileSize - 1
122+ : offset + length
123+ ) ;
111124 const response = await this . client . request ( {
112125 headers : {
113126 ...this . headers ,
114- Range : `bytes=${ offset } -${ offset + length } ` ,
127+ Range : `bytes=${ offset } -${ end } ` ,
115128 } ,
116129 signal,
117130 } ) ;
You can’t perform that action at this time.
0 commit comments