From bd455426f6ade80b80ab44f3ae3e946e44303120 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Wed, 22 Dec 2021 14:40:42 +0000 Subject: moduleapi: Support stripping of multi-word from module names The goal is to allow module:provides("foo-bar") with a mod_foo_bar_ prefix being stripped. It will break any existing modules that use a prefix and have hyphens instead of underscores. No such modules are known. --- core/moduleapi.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core') diff --git a/core/moduleapi.lua b/core/moduleapi.lua index 6a91a045..24d99c69 100644 --- a/core/moduleapi.lua +++ b/core/moduleapi.lua @@ -355,7 +355,7 @@ function api:provides(name, item) local item_name = self.name; -- Strip a provider prefix to find the item name -- (e.g. "auth_foo" -> "foo" for an auth provider) - if item_name:find(name.."_", 1, true) == 1 then + if item_name:find((name:gsub("%-", "_")).."_", 1, true) == 1 then item_name = item_name:sub(#name+2); end item.name = item_name; -- cgit v1.2.3