File tree 1 file changed +12
-2
lines changed 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 {
51
51
}
52
52
53
53
async fetchSlices ( slices , signal ) {
54
+ const end = (
55
+ ( this . _fileSize && ( offset + length >= this . _fileSize ) )
56
+ ? this . _fileSize - 1
57
+ : offset + length
58
+ ) ;
54
59
const response = await this . client . request ( {
55
60
headers : {
56
61
...this . headers ,
57
62
Range : `bytes=${ slices
58
- . map ( ( { offset, length } ) => `${ offset } -${ offset + length } ` )
63
+ . map ( ( { offset, length } ) => `${ offset } -${ end } ` )
59
64
. join ( ',' )
60
65
} `,
61
66
} ,
@@ -108,10 +113,15 @@ class RemoteSource extends BaseSource {
108
113
109
114
async fetchSlice ( slice , signal ) {
110
115
const { offset, length } = slice ;
116
+ const end = (
117
+ ( this . _fileSize && ( offset + length >= this . _fileSize ) )
118
+ ? this . _fileSize - 1
119
+ : offset + length
120
+ ) ;
111
121
const response = await this . client . request ( {
112
122
headers : {
113
123
...this . headers ,
114
- Range : `bytes=${ offset } -${ offset + length } ` ,
124
+ Range : `bytes=${ offset } -${ end } ` ,
115
125
} ,
116
126
signal,
117
127
} ) ;
You can’t perform that action at this time.
0 commit comments