parent
39eca7b8ce
commit
124fead8ff
|
@ -88,10 +88,7 @@ function fetchFile(req, res, next) {
|
||||||
// They are requesting an explicit filename. Only try to find an
|
// They are requesting an explicit filename. Only try to find an
|
||||||
// index file if they are NOT requesting an HTML directory listing.
|
// index file if they are NOT requesting an HTML directory listing.
|
||||||
useIndex = filename[filename.length - 1] !== '/'
|
useIndex = filename[filename.length - 1] !== '/'
|
||||||
} else if (req.query.main) {
|
} else if (req.query.main && typeof req.packageConfig[req.query.main] === 'string') {
|
||||||
if (!(req.query.main in req.packageConfig))
|
|
||||||
return res.status(404).type('text').send(`Cannot find field "${req.query.main}" in ${req.packageSpec} package config`)
|
|
||||||
|
|
||||||
// They specified a custom ?main field.
|
// They specified a custom ?main field.
|
||||||
filename = req.packageConfig[req.query.main]
|
filename = req.packageConfig[req.query.main]
|
||||||
} else if (typeof req.packageConfig.unpkg === 'string') {
|
} else if (typeof req.packageConfig.unpkg === 'string') {
|
||||||
|
|
Loading…
Reference in New Issue