proto.io 0.0.204 → 0.0.205

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -2165,12 +2165,14 @@ var filesRoute = (router, proto) => {
2165
2165
  let stream;
2166
2166
  if (_.isArray(ranges) && ranges.type === 'bytes') {
2167
2167
  const startBytes = _.minBy(ranges, r => r.start)?.start ?? 0;
2168
- const endBytes = _.maxBy(ranges, r => r.end)?.end ?? file.size;
2168
+ const endBytes = _.maxBy(ranges, r => r.end)?.end ?? (file.size - 1);
2169
+ res.setHeader('Content-Length', endBytes - startBytes + 1);
2169
2170
  res.setHeader('Content-Range', `bytes ${startBytes}-${endBytes}/${file.size}`);
2170
2171
  res.status(206);
2171
2172
  stream = payload.fileStorage.fileData(payload, file.token, startBytes, endBytes);
2172
2173
  }
2173
2174
  else {
2175
+ res.setHeader('Content-Length', file.size);
2174
2176
  res.status(200);
2175
2177
  stream = payload.fileStorage.fileData(payload, file.token);
2176
2178
  }