Merge pull request #121 from overleaf/spd-gcs-byte-range

Fix Filestore returning one-too-many bytes when given a range
This commit is contained in:
Simon Detheridge 2020-06-09 16:32:42 +01:00 committed by GitHub
commit 59551fc140
3 changed files with 2 additions and 6 deletions

View file

@ -115,10 +115,6 @@ async function sendStream(bucketName, key, readStream, sourceMd5) {
async function getFileStream(bucketName, key, _opts = {}) { async function getFileStream(bucketName, key, _opts = {}) {
const opts = Object.assign({}, _opts) const opts = Object.assign({}, _opts)
if (opts.end) {
// S3 (and http range headers) treat 'end' as inclusive, so increase this by 1
opts.end++
}
const stream = storage const stream = storage
.bucket(bucketName) .bucket(bucketName)
.file(key) .file(key)

View file

@ -1,4 +1,4 @@
FROM fsouza/fake-gcs-server:1.18.4 FROM fsouza/fake-gcs-server:latest
RUN apk add --update --no-cache curl RUN apk add --update --no-cache curl
COPY healthcheck.sh /healthcheck.sh COPY healthcheck.sh /healthcheck.sh
HEALTHCHECK --interval=1s --timeout=1s --retries=30 CMD /healthcheck.sh http://localhost:9090 HEALTHCHECK --interval=1s --timeout=1s --retries=30 CMD /healthcheck.sh http://localhost:9090

View file

@ -196,7 +196,7 @@ describe('GcsPersistorTests', function() {
it('passes the byte range on to GCS', function() { it('passes the byte range on to GCS', function() {
expect(GcsFile.createReadStream).to.have.been.calledWith({ expect(GcsFile.createReadStream).to.have.been.calledWith({
start: 5, start: 5,
end: 11 // we increment the end because Google's 'end' is exclusive end: 10
}) })
}) })
}) })