Skip to content

Commit

Permalink
Merge pull request #12 from emiro85/master
Browse files Browse the repository at this point in the history
Fix ReferenceError if symfile is not included in form
  • Loading branch information
acrisci committed Sep 1, 2017
2 parents 616a282 + 0b15a35 commit ae2345f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/app.coffee
Expand Up @@ -241,7 +241,7 @@ run = ->
breakpad.get '/symfiles/:id', (req, res, next) ->
Symfile.findById(req.params.id).then (symfile) ->
if not symfile?
resturn res.send 404, 'Symfile not found'
return res.send 404, 'Symfile not found'

if 'raw' of req.query
res.set 'content-type', 'text/plain'
Expand Down Expand Up @@ -314,7 +314,7 @@ run = ->

breakpad.use(busboy())
breakpad.post '/symfiles', (req, res, next) ->
Symfile.createFromRequest req, (err, symfile) ->
Symfile.createFromRequest req, res, (err, symfile) ->
return next(err) if err?
symfileJson = symfile.toJSON()
delete symfileJson.contents
Expand Down
4 changes: 2 additions & 2 deletions src/model/symfile.coffee
Expand Up @@ -49,7 +49,7 @@ Symfile.saveToDisk = (symfile) ->
filePath = path.join(symfileDir, symbol_name)
fs.writeFile(filePath, symfile.contents)

Symfile.createFromRequest = (req, callback) ->
Symfile.createFromRequest = (req, res, callback) ->
props = {}
streamOps = []

Expand All @@ -67,7 +67,7 @@ Symfile.createFromRequest = (req, callback) ->

req.busboy.on 'finish', ->
Promise.all(streamOps).then ->
if not 'symfile' of props
if not props.hasOwnProperty('symfile')
res.status 400
throw new Error 'Form must include a "symfile" field'

Expand Down

0 comments on commit ae2345f

Please sign in to comment.