Skip to content

Commit

Permalink
Throw 404 in case of an unpublished module - fix #271
Browse files Browse the repository at this point in the history
  • Loading branch information
robertkowalski committed Mar 18, 2013
1 parent 7f727fa commit 70a7d49
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions routes/package-page.js
Expand Up @@ -25,6 +25,10 @@ function packagePage (req, res) {
if (er && er.code === 'E404') return res.error(404, er) if (er && er.code === 'E404') return res.error(404, er)
if (er) return res.error(er) if (er) return res.error(er)
if (!m.package) return res.error(404) if (!m.package) return res.error(404)
// We are catching this one very late in the application
// as the npm-client will have cached this response as json
// and we are not getting a valid http error code in that case
if (m.package.error === 'not_found') return res.error(404)


var p = m.package var p = m.package
p.dependents = m.browse p.dependents = m.browse
Expand Down

0 comments on commit 70a7d49

Please sign in to comment.