From 2a7ce038d539de96ecac39a2807cec219979c3a4 Mon Sep 17 00:00:00 2001 From: Leonard Martin Date: Thu, 21 Jan 2016 16:06:50 +0000 Subject: [PATCH] Update regex to parse hook names from module identities 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` --- lib/hooks/moduleloader/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/hooks/moduleloader/index.js b/lib/hooks/moduleloader/index.js index b8f507840..023b3fc88 100644 --- a/lib/hooks/moduleloader/index.js +++ b/lib/hooks/moduleloader/index.js @@ -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) {