mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Refactor, and log when we have a 'range' header.
This commit is contained in:
parent
387e96ab67
commit
8a631e70f7
1 changed files with 6 additions and 5 deletions
|
@ -13,19 +13,20 @@ module.exports = FileController =
|
||||||
getFile: (req, res)->
|
getFile: (req, res)->
|
||||||
{key, bucket} = req
|
{key, bucket} = req
|
||||||
{format, style} = req.query
|
{format, style} = req.query
|
||||||
opts = {
|
options = {
|
||||||
key: key,
|
key: key,
|
||||||
bucket: bucket,
|
bucket: bucket,
|
||||||
format: format,
|
format: format,
|
||||||
style: style,
|
style: style,
|
||||||
}
|
}
|
||||||
metrics.inc "getFile"
|
metrics.inc "getFile"
|
||||||
|
logger.log key:key, bucket:bucket, format:format, style: style, "reciving request to get file"
|
||||||
if req.headers.range?
|
if req.headers.range?
|
||||||
range = FileController._get_range(req.headers.range)
|
range = FileController._get_range(req.headers.range)
|
||||||
opts.start = range.start
|
options.start = range.start
|
||||||
opts.end = range.end
|
options.end = range.end
|
||||||
logger.log key:key, bucket:bucket, format:format, style:style, "reciving request to get file"
|
logger.log start: range.start, end: range.end, "getting range of bytes from file"
|
||||||
FileHandler.getFile bucket, key, opts, (err, fileStream)->
|
FileHandler.getFile bucket, key, options, (err, fileStream)->
|
||||||
if err?
|
if err?
|
||||||
logger.err err:err, key:key, bucket:bucket, format:format, style:style, "problem getting file"
|
logger.err err:err, key:key, bucket:bucket, format:format, style:style, "problem getting file"
|
||||||
if !res.finished and res?.send?
|
if !res.finished and res?.send?
|
||||||
|
|
Loading…
Reference in a new issue