Return 404 for packages with no version info
This commit is contained in:
parent
40cac70cc2
commit
c3d9ede460
|
@ -124,12 +124,9 @@ const createRequestHandler = (options = {}) => {
|
||||||
if (error)
|
if (error)
|
||||||
return sendServerError(res, error)
|
return sendServerError(res, error)
|
||||||
|
|
||||||
if (packageInfo == null)
|
if (packageInfo == null || packageInfo.versions == null)
|
||||||
return sendNotFoundError(res, `package "${packageName}"`)
|
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
|
const { versions, 'dist-tags': tags } = packageInfo
|
||||||
|
|
||||||
if (version in versions) {
|
if (version in versions) {
|
||||||
|
|
Loading…
Reference in New Issue