diff options
Diffstat (limited to 'custom')
-rw-r--r--custom/extensions/email-gravatar.lua9
-rw-r--r--custom/extensions/email-libravatar.lua9
2 files changed, 12 insertions, 6 deletions
diff --git a/custom/extensions/email-gravatar.lua b/custom/extensions/email-gravatar.lua
index 836841f..eca31ee 100644
--- a/custom/extensions/email-gravatar.lua
+++ b/custom/extensions/email-gravatar.lua
@@ -81,9 +81,12 @@ local function normalize_email(email)
if email == nil then
return nil
end
- local inner = email:match("<(.*)>")
- if inner ~= nil then
- email = inner
+ -- The first "<" and the last ">" are found directly, because "<(.*)>"
+ -- backtracks to the end of the address from every "<" in it.
+ local open = email:find("<", 1, true)
+ local close = email:find(">[^>]*$")
+ if open and close and close > open then
+ email = email:sub(open + 1, close - 1)
end
email = trim(email):lower()
if email == "" then
diff --git a/custom/extensions/email-libravatar.lua b/custom/extensions/email-libravatar.lua
index 2b1fecd..3422dc1 100644
--- a/custom/extensions/email-libravatar.lua
+++ b/custom/extensions/email-libravatar.lua
@@ -79,9 +79,12 @@ local function normalize_email(email)
if email == nil then
return nil
end
- local inner = email:match("<(.*)>")
- if inner ~= nil then
- email = inner
+ -- The first "<" and the last ">" are found directly, because "<(.*)>"
+ -- backtracks to the end of the address from every "<" in it.
+ local open = email:find("<", 1, true)
+ local close = email:find(">[^>]*$")
+ if open and close and close > open then
+ email = email:sub(open + 1, close - 1)
end
email = trim(email):lower()
if email == "" then