Return 404 for packages with no version info

This commit is contained in:
MICHAEL JACKSON 2017-06-09 10:10:42 -07:00
parent 40cac70cc2
commit c3d9ede460
1 changed files with 1 additions and 4 deletions

View File

@ -124,12 +124,9 @@ const createRequestHandler = (options = {}) => {
if (error)
return sendServerError(res, error)
if (packageInfo == null)
if (packageInfo == null || packageInfo.versions == null)
return sendNotFoundError(res, `package "${packageName}"`)
if (packageInfo.versions == null)
return sendServerError(res, new Error(`Unable to retrieve info for package ${packageName}`))
const { versions, 'dist-tags': tags } = packageInfo
if (version in versions) {