0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2025-01-20 22:52:46 -05:00

Fix undefined path value

This commit is contained in:
Juan Picado 2017-04-22 09:31:12 +02:00
parent 7df6962f43
commit 580d3e77f7
No known key found for this signature in database
GPG key ID: 18AC54485952D158
2 changed files with 6 additions and 5 deletions

View file

@ -22,7 +22,7 @@ function load_plugins(config, plugin_configs, params, sanity_check) {
if (plugin === null && p.match(/^[^\.\/]/)) {
plugin = try_load('verdaccio-' + p)
// compatibility for old sinopia plugins
if(!plugin) {
if (!plugin) {
plugin = try_load('sinopia-' + p)
}
}
@ -37,18 +37,18 @@ function load_plugins(config, plugin_configs, params, sanity_check) {
}
if (plugin === null) {
throw Error('"' + p + '" plugin not found\ntry "npm install verdaccio-' + p + '"')
throw new Error('"' + p + '" plugin not found\ntry "npm install verdaccio-' + p + '"')
}
if (typeof(plugin) !== 'function')
throw Error('"' + p + '" doesn\'t look like a valid plugin')
throw new Error('"' + p + '" doesn\'t look like a valid plugin')
plugin = plugin(plugin_configs[p], params)
if (plugin === null || !sanity_check(plugin))
throw Error('"' + p + '" doesn\'t look like a valid plugin')
throw new Error('"' + p + '" doesn\'t look like a valid plugin')
return plugin
return plugin;
})
return plugins

View file

@ -54,6 +54,7 @@ describe('plugin loader', function() {
it('testing auth plugin no plugins', function() {
let _config = {
self_path: path.join(__dirname, './'),
auth: {
'./unit/partials/test-plugin-storage/invalid-package': {}
}