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 {
55
55
headers : {
56
56
...this . headers ,
57
57
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
+ } )
59
67
. join ( ',' )
60
68
} `,
61
69
} ,
@@ -108,10 +116,15 @@ class RemoteSource extends BaseSource {
108
116
109
117
async fetchSlice ( slice , signal ) {
110
118
const { offset, length } = slice ;
119
+ const end = (
120
+ ( this . _fileSize && ( offset + length >= this . _fileSize ) )
121
+ ? this . _fileSize - 1
122
+ : offset + length
123
+ ) ;
111
124
const response = await this . client . request ( {
112
125
headers : {
113
126
...this . headers ,
114
- Range : `bytes=${ offset } -${ offset + length } ` ,
127
+ Range : `bytes=${ offset } -${ end } ` ,
115
128
} ,
116
129
signal,
117
130
} ) ;
You can’t perform that action at this time.
0 commit comments