aheckmann / gridfs-stream

Easily stream files to and from MongoDB
MIT License
615 stars 120 forks source link

ReadStream: incorrect validation of range.endPos when endPos is 0 #142

Open lkho opened 5 years ago

lkho commented 5 years ago

when specifying { endPos: 0 }, it is converted to position - 1. However, it is indeed valid since startPos/endPos is inclusive.

https://github.com/aheckmann/gridfs-stream/blob/c394e050d066a5c81c6dcdddad186b08a93d5f1f/lib/readstream.js#L117-L123