0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2025-01-06 22:40:26 -05:00

Merge pull request #136 from psychocode/fix-webreadme

optional scope in the readme package name.
This commit is contained in:
jotadeveloper 2017-03-18 14:07:07 +01:00 committed by GitHub
commit 773ac4922b

View file

@ -150,8 +150,10 @@ module.exports = function(config, auth, storage) {
}
})
app.get('/-/readme/:package/:version?', can('access'), function(req, res, next) {
storage.get_package(req.params.package, {req: req}, function(err, info) {
app.get('/-/readme(/@:scope?)?/:package/:version?', can('access'), function(req, res, next) {
var packageName = req.params.package;
if (req.params.scope) packageName = "@"+ req.params.scope + "/" + packageName;
storage.get_package(packageName, {req: req}, function(err, info) {
if (err) return next(err)
next( renderReadme(info.readme || 'ERROR: No README data found!') )
})