Skip to content

Commit

Permalink
more verbose bodies on 404 GET
Browse files Browse the repository at this point in the history
  • Loading branch information
vencax committed Oct 30, 2015
1 parent 2c3994e commit 47fb768
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/controllers.coffee
Expand Up @@ -33,14 +33,14 @@ module.exports = (UploadModel) ->

#GET MUST return Content-Length == Final-Length
getFile: (req, res, next) ->
return res.status(404).send("Not Found") unless req.params.id?
return res.status(404).send("id missing") unless req.params.id?

_fileInfo.load req.params.id, (err, fleInfo)->
return res.status(400).send(err) if err
return res.status(404).send("Not Found") if not fleInfo
return res.status(404).send("metas not found") if not fleInfo

if fleInfo.offset != fleInfo.final_length
return res.status(404).send("Not Found")
return res.status(404).send("uncomplete")

res.setHeader "Content-Length", fleInfo.final_length
stream = fs.createReadStream(path.join(filesDir, req.params.id))
Expand Down

0 comments on commit 47fb768

Please sign in to comment.