Skip to content

Commit

Permalink
Update regex to parse hook names from module identities
Browse files Browse the repository at this point in the history
This allows the hook names to be correctly parsed from modules published to npm under a user's namespace/scope - e.g. `@user/sails-hook-name`
  • Loading branch information
lennym authored and ctartist621 committed Feb 3, 2016
1 parent a2a1d1a commit 2a7ce03
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/hooks/moduleloader/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ module.exports = function(sails) {
}
// Otherwise use the module name, with initial "sails-hook" stripped off if it exists
else {
hookName = identity.match(/^sails-hook-/) ? identity.replace(/^sails-hook-/,'') : identity;
hookName = identity.match(/^(sails-hook-)|(@.+\/sails-hook-)/) ? identity.replace(/^(sails-hook-)|(@.+\/sails-hook-)/,'') : identity;
}

if (sails.config.hooks[hookName] === false) {
Expand Down

0 comments on commit 2a7ce03

Please sign in to comment.